Data Access Problem in Vb.net

  • Thread starter Thread starter farhan
  • Start date Start date
F

farhan

iam using this code but the moment i click on submit it
says "Insert Error: Column name or number of supplied
values does not match table definition" although there is
nothing wrong in the table


If IsValid Then

Dim cn As OleDbConnection
Dim str As String
Dim rs As OleDbCommand
Dim query As String

str = "provider=SQLOLEDB.1;persist security
info=False; User ID=ma;Password=ma;Initial
Catalog=sch;Data Source=SCSTS-8;Initial File
Name=D:\Program Files\Microsoft SQL
Server\MSSQL\Data\sch_data.mdf"
cn = New OleDbConnection(str)
query = "insert into sch values ('" &
txt_name.Text & "," & txt_date.Text & "','" &
txt_serial.Text & "','" & txt_issues.Text & "','" &
txt_recover.Text & "','" & txt_sol.Text & " ','" &
txt_remarks.Text & "')"
rs = New OleDbCommand(query, cn)
cn.Open()
rs.ExecuteReader()
cn.Close()
 
Back
Top