data type mismatch in criteria expression
I am coding a website and have run into a problem I can't seem to figure out.
I keep getting the above error when I am trying to use this code.
1 Protected Sub UpdateData_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles UpdateData.Click
2
3 Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
4 Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString )
5 Dim strInsert As String = "INSERT INTO Data(MajorProblem, Cat_Street_Number, Cat_Score, StartAddr, EndAddr, CatId, SubId, Sid, NeighborhoodID)VALUES("
6 Dim majorProblem As Integer = 0
7 dbCommand.Connection = dbConnection
8 dbCommand.Connection.Open()
9 If RubbishMajor.Checked Then
10 majorProblem = 1
11 Else
12 majorProblem = 0
13 End If
14 If OverFilledBins.Checked Then
15 Dim sub1 As String = 1
16 strInsert = strInsert & "'" & majorProblem & "', '" & OverFilledAddr.Text & "', '" & Rubbishscore.Text & "', '" & StartAddr.Text & "', '" & EndAddr.Text & "', "
17
18 strInsert = strInsert & "'SELECT SubCat.CatId FROM SubCat WHERE SubId = 1', 'sub1', "
19 strInsert = strInsert & "'SELECT Street_Lookup.Sid FROM Street_Lookup WHERE " & ddlStreetName.SelectedValue & " = St_name', "
20 strInsert = strInsert & "'SELECT Neighborhood.NeighborhoodID FROM Neighborhood WHERE " & ddlNeighborhood.SelectedValue & " = NeighborhoodDesc'"
21 End If
22
23 strInsert = strInsert + ")"
24 dbCommand.CommandText = strInsert
25 dbCommand.ExecuteNonQuery()
26 dbCommand.Connection.Close()
27 End Sub
If someone could please tell me what Im doing wrong that would be amazing.
|