Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 10th, 2007, 03:54 PM
Registered User
 
Join Date: Dec 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
 
Old December 10th, 2007, 06:49 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

You should pot the eact error including the line number. This helps others help you...

Have you asked Goggle? (http://www.google.com.au/search?hl=e...e+Search&meta=)

Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Data type mismatch in criteria expression Tawanda BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 0 May 5th, 2007 05:29 PM
data type mismatch in criteria expression xigler Access 3 March 23rd, 2007 08:54 AM
Data type mismatch in criteria expression. imercha Classic ASP Basics 3 November 23rd, 2006 11:09 AM
Data type mismatch in criteria expression. EDEN Access ASP 1 November 22nd, 2006 01:19 AM
Data type mismatch in criteria expression. kalchev ASP.NET 2.0 Professional 5 April 11th, 2006 11:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.