|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
to veiw data in datagridShow quote > application.....the datbase is ms sql server...in my > front end form there is a datagrid where i have > displayed the details from the database by dragging > it into a dataset.....after words i have created a > test box where i enter some selective details from > the grid and the the entire details is then > retrieved and then displayed on the data grid...but > there is a problem ...the selection of data is not > working and it doest show any error...i m giving the > code i have created ...c if u can figure out > anything > > Private Sub txtcid1_TextChanged(ByVal sender As > System.Object, ByVal e As System.EventArgs) Handles > txtcid1.TextChanged > > Dim constr As String = "C:\Documents and > Settings\rupesh\My Documents\ME.mdf;Integrated > Security=True;Connect Timeout=30;User Instance=True" > > Dim conn As SqlClient.SqlConnection = New > SqlClient.SqlConnection(constr) > > Dim sqlstr As String = "SELECT * FROM Course > WHERE COURSE ID LIKE'" & Trim(txtcid1.Text) & "%'" > Dim da As SqlClient.SqlDataAdapter = New > SqlClient.SqlDataAdapter(sqlstr, conn) > > Dim ds As DataSet = New DataSet > da.Fill(ds, "Course") > DataGridView1.DataSource = > ds.DefaultViewManager > > End Sub > Hi,
Try this code: DataGridView1.DataSource = ds.Tables(0) -- Show quoteIf my answer helped you,then please do press Yes below. Thanks and Regards. Manish Bafna. MCP and MCTS. "lijin" wrote: > its a vb.net code .....im doing a data base > > application.....the datbase is ms sql server...in my > > front end form there is a datagrid where i have > > displayed the details from the database by dragging > > it into a dataset.....after words i have created a > > test box where i enter some selective details from > > the grid and the the entire details is then > > retrieved and then displayed on the data grid...but > > there is a problem ...the selection of data is not > > working and it doest show any error...i m giving the > > code i have created ...c if u can figure out > > anything > > > > Private Sub txtcid1_TextChanged(ByVal sender As > > System.Object, ByVal e As System.EventArgs) Handles > > txtcid1.TextChanged > > > > Dim constr As String = "C:\Documents and > > Settings\rupesh\My Documents\ME.mdf;Integrated > > Security=True;Connect Timeout=30;User Instance=True" > > > > Dim conn As SqlClient.SqlConnection = New > > SqlClient.SqlConnection(constr) > > > > Dim sqlstr As String = "SELECT * FROM Course > > WHERE COURSE ID LIKE'" & Trim(txtcid1.Text) & "%'" > > Dim da As SqlClient.SqlDataAdapter = New > > SqlClient.SqlDataAdapter(sqlstr, conn) > > > > Dim ds As DataSet = New DataSet > > da.Fill(ds, "Course") > > DataGridView1.DataSource = > > ds.DefaultViewManager > > > > End Sub > > |
|||||||||||||||||||||||