hello friends
I have three tables with similer structure and same column name id,sname,ssno,grade.
I want to copy rows from table1 to table2 and table3 based on column grade . I am getting an error
No value given for one or more required parameters.
can someone kindly tell me how do i fix the error ?
sql
"insert into table2(id,sname,ssno,grade) select id,sname,ssno,grade from table1 where grade =A"
"insert into table3(id,sname,ssno,grade) select id,sname,ssno,grade from table1 where grade =B"
here is my full code
Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\dtb.accdb")
Dim CmdStr As String
CmdStr = "insert into table3(id,sname,ssno,grade) select id,sname,ssno,grade from table1 where grade =B"
CmdStr = "insert into table2(id,sname,ssno,grade) select id,sname,ssno,grade from table1 where grade =A"
con.Open()
Dim cmd As OleDbCommand = New OleDbCommand(CmdStr, con)
cmd.ExecuteNonQuery()
con.Close()
MsgBox("Done")