Adding data in multiple tables in vb.net
Posted
by user225269
on Stack Overflow
See other posts from Stack Overflow
or by user225269
Published on 2010-03-20T05:55:32Z
Indexed on
2010/03/20
6:01 UTC
Read the original article
Hit count: 324
This is a winform and I'm using mysql as a database, here is my code: I'm trying to add data into multiple tables.
If TextBox14.Text = "" Or TextBox7.Text = "" Or TextBox10.Text = "" Then
MsgBox("Please fill up the fields with a labels in bold letters!", MsgBoxStyle.Information)
cn = New MySqlConnection("Server=localhost; Database=school;Uid=root;Pwd=nitoryolai123$%^;")
'provider to be used when working with access database
cn.Open()
cmd = New MySqlCommand("select * from parents, mother, father", cn)
cmd.CommandText = "insert into parents values('" + idnum + "','" + p_contact + "','" + p_ad + "')"
cmd.CommandText = "insert into mother values('" + idnum + "','" + mother + "','" + mother_occu + "')"
cmd.CommandText = "insert into father values('" + idnum + "','" + father + "',''" + father_occu + "')"
cmd.ExecuteNonQuery()
I get this error, please help: Index and length must refer to a location within the string. Parameter name: length
© Stack Overflow or respective owner