I am just picking back up ASP.net and I'm looking to pick up a project from college. I can't seem to fix this error and am not sure what it is. I was wondering if anyone could help me wit the error.
It say this: OleDbException was unhandled by user code, syntax error (missing operator) in query expression 'SupplierID=' with this line
drSupplier = cmdSelectSup.ExecuteReader().
I can't figure it out. Here is the code for the page. Thanks for all the help in advance.
Imports System.Data Imports System.Data.OleDb
Partial Class viewSuppInfo Inherits System.Web.UI.Page Public Sub readSupplier() Dim suppID = Session("SupplierID")
Dim objConnection As OleDbConnection objConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Users\Tony V\Documents\Old Hard Drive Files\Visual Studio 2005\WebSites\leancorfinal\App_Data\LeanC.mdb") 'objConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; DataSource= C:\Documents and Settings\Jackie Werle\My Documents\Visual Studio 2005\WebSites\WebSite1\App_Data\LeanC.mdb")
objConnection.Open() Dim drSupplier As OleDbDataReader Dim SelectSupSql As String SelectSupSql = "Select SupplierName, Address, Country, City, State, Zip, ContactName, ContactPhone, ContactEmail, ContactFax, PlannerName, AfterHoursContact, BegShipHours, EndShippingHours from Supplier where SupplierID=" & suppID Dim cmdSelectSup As OleDbCommand
vspplnrsName.Text = drSupplier("PlannerName") vspaHCTs.Text = drSupplier("AfterHoursContact") vspbSHs.Text = drSupplier("BegShipHours") vspeSHs.Text = drSupplier("EndShippingHours") End If
End Sub
Protected Sub upSupInfo_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles upsupInfo.Click Dim suppID = Session("SupplierID")
Dim objConnection As OleDbConnection objConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\cbatest\06SIS540\group5\leancor\App_Data\LeanC.mdb") 'objConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; DataSource= C:\Documents and Settings\Jackie Werle\My Documents\Visual Studio 2005\WebSites\WebSite1\App_Data\LeanC.mdb")
Dim cmdUpdateSup As OleDbCommand Dim UpdateSQL As String
UpdateSQL = "Update Supplier set SupplierName=@SupplierName,Address=@Address,City= @City,State=@State,Zip=@Zip,ContactName=@ContactName,ContactPhone=@ContactPhone,ContactEmail=@ContactEmail,ContactFax=@ContactFax,PlannerName=@PlannerName,AfterHoursContact=@AfterHoursContact,BegShipHours=@BegShipHours,EndShippingHours=@EndShippingHours where SupplierID=" & suppID
End Sub Protected Sub page_load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim suppID = Session("SupplierID") supUpdateMessage.Text = "View and/or update the information for Supplier #" & suppID readSupplier()
End Sub Protected Sub viewparts_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles viewParts.Click Dim supID = Session("SupplierID") Session("SuppIDCode") = supID Response.Redirect("SupPart.aspx") End Sub Protected Sub connectCarriers_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles connectCarriers.Click Dim supID = Session("SupplierID") Session("SuppIDCode") = supID Response.Redirect("CarrPrefs.aspx") End Sub End Class
venturac
Member
6 Points
6 Posts
OleDbException was unhandled by user code
Nov 17, 2011 06:12 PM|LINK
Hello,
I am just picking back up ASP.net and I'm looking to pick up a project from college. I can't seem to fix this error and am not sure what it is. I was wondering if anyone could help me wit the error.
It say this: OleDbException was unhandled by user code, syntax error (missing operator) in query expression 'SupplierID=' with this line
drSupplier = cmdSelectSup.ExecuteReader().
I can't figure it out. Here is the code for the page. Thanks for all the help in advance.