insert data into Ms Access

Markoleo

Member
Joined
Aug 5, 2006
Messages
19
Programming Experience
Beginner
complete code for additing data into sql server.

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
but i need such code for ms access, plese help me, it's promptly.
 
Last edited by a moderator:
Back
Top