Hi Everyone,
First of all, thanx Mojio for providing me the right code information on connecting sql server database.
As I'm a beginner in ASP.NET, using vb as language. I have created few text boxes on the form as an input to the application. I hav managed to insert the records to the sql, but not managed to search & update the records from sql.
My Code's on Insert Button:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strConn As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\staff.mdf;Integrated Security=True;User Instance=True"
Dim cmd As New SqlCommand("INSERT INTO Staff (NRIC, Name, Address, TelNo)VALUES('" & txtIC.Text & "','" & txtName.Text & "','" & txtAddress.Text & "','" & txtTelNo.Text & "')", New SqlConnection(strConn))
cmd.Connection.Open()
cmd.ExecuteNonQuery()
cmd.Connection.Close()
End Sub
My Query:
I'm trying to update the records thru the textboxes created. The scenario is, the user will key in his student ID in the enter student ID textbox and click on the search button. Then All the details about him such as name, telNO will be displayed accordingly in other textboxes created.How can I retrieve the data from sql back into the textboxes created and from there i edit and update the changes back to sql. Please advise 10q.
Regards,
Sathiya