I am using VB2008 fr my project , I am having an error while inserting data in the sales form

The error is;:__

"Number of query values and destination fields are not the same".

Here is my code-:

Dim sql As String
    sql = "insert into sales (SalesId ,PropertyNo, SellerNo, BuyerNo, PropertyType, Region, Commission, SellingPrice, DateOfSale) values ('" & SalesIdTextBox.Text & "', '" & PropertyNoTextBox1.Text & "','" & SellerNoTextBox.Text & "','" & BuyerNoTextBox1.Text & "','" & PropertyTypeTextBox1.Text & "','" & RegionTextBox.Text & "','" & CommissionTextBox.Text & "','" & SellingPriceTextBox1.Text & "', '" & DateOfSaleDateTimePicker.Value.Date & "',  0)"
UpdateRecord(sql)

Thanks

Recommended Answers

All 2 Replies

You have 9 columns listed in the SQL statement but ten inputs in the values section including the zero at the end. The zero has no matching column specified.

thxx dr..it hlped me..the program works now;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.