473,399 Members | 4,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

OLE prob - Must declare the variable '@Title'.

27
I'm having a problem with updating a record through a form.

Here is the error:

[HTML]Server Error in '/AccoEndUser' Application.
--------------------------------------------------------------------------------

Must declare the variable '@Title'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Must declare the variable '@Title'.

Source Error:


Line 202: objConn.open()
Line 203:
Line 204: objCmd.ExecuteNonQuery()
Line 205:
Line 206: objConn.close()[/HTML]

And here is my code:

[HTML]<!-- #include file="includes/acco_inc.aspx"-->
<%@ import namespace="System.Data" %>
<%@ import namespace="System.Data.OleDb" %>
<Script Language="VB" Runat="Server">



dim objCmd As OleDbCommand
dim objRdr As OleDbDataReader
dim strCmd As String

sub UpdateRec(s As Object, e As EventArgs)

dim dsn As String = ConfigurationSettings.AppSettings("SystemConnectio n")

dim objConn as New OleDbConnection(dsn)

objCmd = New OleDbCommand("UPDATE tbl_ACCO_EU_Contacts SET Title=@Title, FirstName=@FirstName, LastName=@LastName, CompanyPosition=@CompanyPosition, CompanyName=@CompanyName, CompanyAddress1=@CompanyAddress1, CompanyAddress2=@CompanyAddress2, CompanyAddress3=@CompanyAddress3, CompanyAddress4=@CompanyAddress4, CompanyTown=@CompanyTown, CompanyCounty=@CompanyCounty, CompanyPostcode=@CompanyPostcode, CompanyEMailAddress=@CompanyEMailAddress, CompanyTelephone=@CompanyTelephone, CompanyFax=@CompanyFax, CompanyDirectDial=@CompanyDirectDial, CompanyWebAddress=@CompanyWebAddress, CompanySIC=@CompanySIC, CompanySize=@CompanySize, PersonalAddress1=@PersonalAddress1, PersonalAddress3=@PersonalAddress3, PersonalAddress4=@PersonalAddress4, PersonalTown=@PersonalTown, PersonalCounty=@PersonalCounty, PersonalPostCode=@PersonalPostCode, PersonalCountry=@PersonalCountry WHRER EndUserID=@EndUserID" , objConn )

objCmd.Parameters.Add("@Title", textTitle.Text)
objCmd.Parameters.Add("@FirstName", textFirstName.Text)
objCmd.Parameters.Add("@LastName", textLastName.Text)
objCmd.Parameters.Add("@CompanyPosition", textCompanyPosition.Text)
objCmd.Parameters.Add("@CompanyName", textCompanyName.Text)
objCmd.Parameters.Add("@CompanyAddress1", textCompanyAddress1.Text)
objCmd.Parameters.Add("@CompanyAddress2", textCompanyAddress2.Text)
objCmd.Parameters.Add("@CompanyAddress3", textCompanyAddress3.Text)
objCmd.Parameters.Add("@CompanyAddress4", textCompanyAddress4.Text)
objCmd.Parameters.Add("@CompanyTown", textCompanyTown.Text)
objCmd.Parameters.Add("@CompanyCounty", textCompanyCounty.Text)
objCmd.Parameters.Add("@CompanyPostcode", textCompanyPostcode.Text)
objCmd.Parameters.Add("@CompanyEMailAddress", textCompanyEMailAddress.Text)
objCmd.Parameters.Add("@CompanyTelephone", textCompanyTelephone.Text)
objCmd.Parameters.Add("@CompanyFax", textCompanyFax.Text)
objCmd.Parameters.Add("@CompanyDirectDial", textCompanyDirectDial.Text)
objCmd.Parameters.Add("@CompanyWebAddress", textCompanyWebAddress.Text)
objCmd.Parameters.Add("@CompanySIC", textCompanySIC.Text)
objCmd.Parameters.Add("@CompanySize", textCompanySize.Text)
objCmd.Parameters.Add("@PersonalAddress1", textPersonalAddress1.Text)
objCmd.Parameters.Add("@PersonalAddress2", textPersonalAddress2.Text)
objCmd.Parameters.Add("@PersonalAddress3", textPersonalAddress3.Text)
objCmd.Parameters.Add("@PersonalAddress4", textPersonalAddress4.Text)
objCmd.Parameters.Add("@PersonalTown", textPersonalTown.Text)
objCmd.Parameters.Add("@PersonalCounty", textPersonalCounty.Text)
objCmd.Parameters.Add("@PersonalPostCode", textPersonalPostCode.Text)

objConn.open()

objCmd.ExecuteNonQuery()

objConn.close()

end sub

</script>[/HTML]

Any ideas would be great.

Cheers

Adz
Sep 3 '07 #1
1 2853
Shashi Sadasivan
1,435 Expert 1GB
I have worked with odbc, not oleDb...but they should be similar..
i Sensed a few lines of code missing.

Please check this forum...
http://forums.devx.com/showthread.php?t=152870

Cheers
Sep 3 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Halfdan Holger Knudsen | last post by:
goodday all - here's a snippet of code that just doesn't seem to work...at all! But I haven't got the faintest idea why I keep getting an unref. local var. error. Take a look - I know I can get...
1
by: Bill S. | last post by:
Hi, I a stored procedure that inserts a record into a table as below. The insert works OK, but if the insert violates a unique indewx constraint on one of the columns, the proc terminates...
29
by: Thomas | last post by:
Hi I have an XSL stylesheet: <xsl:for-each select="TRACKS/TRACK"> <tr class="TDL"> <td width="90%"><xsl:number value="position()" format="1" /> - <xsl:value-of select="TRACKTITLE"/></td>...
6
by: rick | last post by:
Noob problem. I prefer to keep all my scripts in an external '.js' file. I am currently loading the external '.js' file from the header. Problem is I would like to declare a global variable in the...
6
by: skubik | last post by:
Hi everyone. I'm attempting to write a Javascript that will create a form within a brand-new document in a specific frame of a frameset. The problem is that I can create the form and input...
6
by: JyotiC | last post by:
hi, i am making a GUI using Tkinter, I have a button and a checkbutton. i want the button to be enable when checkbutton is on and disble when the checkbutton is off. thanx
2
by: andrewanderson | last post by:
hi can anyone help me with this prog. cant find the prob why it cant display cout<<"This is the display of your transaction"<<endl; ifstream fobj; //declare input file stream ...
1
by: ares.lagae | last post by:
- I have a typelist and I want to declare a member variable for each of the types. How can I do that? E.g. I have the typelist "typedef boost::mpl::vector<int, float> types;" and I want to declare...
15
by: the consiglieri | last post by:
hello there .. im not much an expert in C....im trying to use int** for reperesentation of matrices(as double subscripted arrays .)but at run time an error occurs ..saying ...general exception...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.