M
madhu
Hello all,
I am a bignner to vb.net
I am not able to move the dataset and bind the textbox to dataset.
My objective is
1) when the form loads it should display the first record.
and the user should be able to move next and move previous and move
last and move first .
2) Binding the textbox to the dataset
what is the equivlant of text1.text = rs.fields("subject_id") in
vb.net
3) What is the best method of opening the connection and sqldataset ,
sqlcommand
Here is the code where i get an error in the binding.
Form_load
Dim conn As New SqlConnection
Dim cmdSubjects As New SqlCommand
Dim dsSubjects As New DataSet
Dim daSubjects As New SqlDataAdapter
Dim StrSQL As String
Dim SQL_Connection_String As String
SQL_Connection_String = "Server=myserver; DataBase=my_testdb;
Integrated Security=SSPI"
StrSQL = "Select * from Subjects"
conn = New SqlConnection(SQL_Connection_String)
conn.Open()
cmdSubjects = New SqlCommand(StrSQL, conn)
dsSubjects = New DataSet
daSubjects = New SqlDataAdapter(StrSQL, conn)
daSubjects.Fill(dsSubjects, "Subjects")
DataGrid1.DataSource = dsSubjects.Tables!Subjects
TextBox1.DataBindings.Add ("Text", dsSubjects.Tables!Subjeects,
"Subject_ID")
(i get the error at this point)
End sub
Thank in advance.
Please mail to (e-mail address removed) or (e-mail address removed)
From
madhu
I am a bignner to vb.net
I am not able to move the dataset and bind the textbox to dataset.
My objective is
1) when the form loads it should display the first record.
and the user should be able to move next and move previous and move
last and move first .
2) Binding the textbox to the dataset
what is the equivlant of text1.text = rs.fields("subject_id") in
vb.net
3) What is the best method of opening the connection and sqldataset ,
sqlcommand
Here is the code where i get an error in the binding.
Form_load
Dim conn As New SqlConnection
Dim cmdSubjects As New SqlCommand
Dim dsSubjects As New DataSet
Dim daSubjects As New SqlDataAdapter
Dim StrSQL As String
Dim SQL_Connection_String As String
SQL_Connection_String = "Server=myserver; DataBase=my_testdb;
Integrated Security=SSPI"
StrSQL = "Select * from Subjects"
conn = New SqlConnection(SQL_Connection_String)
conn.Open()
cmdSubjects = New SqlCommand(StrSQL, conn)
dsSubjects = New DataSet
daSubjects = New SqlDataAdapter(StrSQL, conn)
daSubjects.Fill(dsSubjects, "Subjects")
DataGrid1.DataSource = dsSubjects.Tables!Subjects
TextBox1.DataBindings.Add ("Text", dsSubjects.Tables!Subjeects,
"Subject_ID")
(i get the error at this point)
End sub
Thank in advance.
Please mail to (e-mail address removed) or (e-mail address removed)
From
madhu