Hi
I am new to this group.
The problem is to display the data in DataGrid
In order to retrieve all the values from the DataBase the following code Runs Without any error.
con1 = New SqlConnection("Persist Security Info=False;User ID=sa;Initial Catalog=Test;Data Source=SERVER\SOFTWARE")
ada1 = New SqlDataAdapter("select * from t2", con1)
MsgBox("Adapter ok:")
dss = New DataSet()
ada1.Fill(dss, "t2")
dg.DataSource = dss.Tables("t2").DefaultView
*******************************************
BUT IF
*******************************************
What we have to do in order to retrieve the value
based upon the value specified in the textbox or Combo Box.
The structure of the Table is some thing like this
it has 3 columns Name age and M.no
Only name field is displayed in the combobox or Name value is specified in the text field
I want to retrive the whole row based upon that Value
I already used these code
*******************************************************
dim gh as string
gh = "select * from t2 where name=' " & Trim(ComboBox1.Text) & " ' "
Dim ada2 = New SqlDataAdapter(gh, con1)
Dim dsss = New DataSet()
ada2.Fill(dsss, "t2")
dg.DataSource = dss.Tables("t2").DefaultView
******************************************************
But it will again show all the Records
Ujjwal G
I am new to this group.
The problem is to display the data in DataGrid
In order to retrieve all the values from the DataBase the following code Runs Without any error.
con1 = New SqlConnection("Persist Security Info=False;User ID=sa;Initial Catalog=Test;Data Source=SERVER\SOFTWARE")
ada1 = New SqlDataAdapter("select * from t2", con1)
MsgBox("Adapter ok:")
dss = New DataSet()
ada1.Fill(dss, "t2")
dg.DataSource = dss.Tables("t2").DefaultView
*******************************************
BUT IF
*******************************************
What we have to do in order to retrieve the value
based upon the value specified in the textbox or Combo Box.
The structure of the Table is some thing like this
it has 3 columns Name age and M.no
Only name field is displayed in the combobox or Name value is specified in the text field
I want to retrive the whole row based upon that Value
I already used these code
*******************************************************
dim gh as string
gh = "select * from t2 where name=' " & Trim(ComboBox1.Text) & " ' "
Dim ada2 = New SqlDataAdapter(gh, con1)
Dim dsss = New DataSet()
ada2.Fill(dsss, "t2")
dg.DataSource = dss.Tables("t2").DefaultView
******************************************************
But it will again show all the Records
Ujjwal G