Data Access Problem in Vb.net

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()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top