complete code for additing data into sql server.
but i need such code for ms access, plese help me, it's promptly.
VB.NET:
Dim c As New SqlClient.SqlConnection("Data Source=notebook;initial catalog=stuslu;user id=vbnet;password=vbnet;Integrated security=false")
Dim da As New SqlClient.SqlCommand("Insert into studnew values(@mbrstud,@imestud,@prezstud,@pbrrodstud,@pbrstan,@datrodstud,@jmbgstud)", c)
Dim dt As New DataTable
Try
da.Parameters.Add("@imestud", "SqlClient.SqlParameter.char").Value = TextBox1.Text
da.Parameters.Add("@prezstud", "SqlClient.SqlParameter.char").Value = TextBox2.Text
da.Parameters.Add("@mbrstud", "SqlClient.SqlParameter.number").Value = TextBox3.Text
da.Parameters.Add("@pbrrodstud", "SqlClient.SqlParameter.number").Value = TextBox4.Text
da.Parameters.Add("@pbrstan", "SqlClient.SqlParameter.number").Value = TextBox5.Text
da.Parameters.Add("@datrodstud", "SqlClient.SqlParameter.char").Value = DateTimePicker1.Value
da.Parameters.Add("@jmbgstud", "SqlClient.SqlParameter.number").Value = TextBox6.Text
c.Open()
da.ExecuteNonQuery()
c.Close()
Catch
MessageBox.Show(" ", "Poruka", MessageBoxButtons.OK)
End Try
Last edited by a moderator: