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