473,394 Members | 1,761 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,394 software developers and data experts.

IConvertible Error???? Help!

Can someone please tell me why I keep getting the following error??? I can't
seem to see what is causing the problem... Any help would be greatly
appritiated!

Thanks

System.InvalidCastException: Object must implement IConvertible.

Line 154: 'objStatusS.Value = fldRSVPs
Line 155:
Line 156: Dim myReader As OleDbDataReader = cmd.ExecuteReader ' Error
Line 157: myReader.Read()


Code:::

Sub UpdateData(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnSubmit.Click

Dim Titleg As String = CType(FindControl("txtTitle"), TextBox).Text
Dim Firstnameg As String = CType(FindControl("txtFirstName"),
TextBox).Text
Dim Lastnameg As String = CType(FindControl("txtLastName"),
TextBox).Text
Dim Statusg As String = CType(FindControl("fldRSVPg"),
RadioButtonList).SelectedItem.Value
Dim Titles As String = CType(FindControl("txtTitles"), TextBox).Text
Dim Firstnames As String = CType(FindControl("txtFirstNames"),
TextBox).Text
Dim Lastnames As String = CType(FindControl("txtLastNames"),
TextBox).Text
Dim Statuss As String = CType(FindControl("fldRSVPs"),
RadioButtonList).SelectedItem.Value

Dim strSQL As String
Dim objConn As OleDbConnection
Dim cmd As OleDbCommand

Dim strSalutation As String
Dim strLastName As String
Dim strFirstName As String
Dim strSalutationS As String
Dim strLastNameS As String
Dim strFirstNameS As String
strSQL = "UPDATE(Person) SET Salutation = '" & strSalutation & "',
Lastname = '" & strLastName & "' , Firstname = '" & strFirstName & "',
SalutationOfPartner = '" & strSalutationS & "' , LastnameOfPartner = '" &
strLastNameS & "', FirstnameOfPartner = '" & strFirstNameS & "' WHERE '" & ID
& "' = LocalIDNumber"

objConn = New
OleDbConnection(ConfigurationSettings.AppSettings( "strConn"))
cmd = New OleDbCommand(strSQL, objConn)

'Try
objConn.Open()
Dim objTitleG, objFirstNameG, objLastNameG, objStatusG, objTitleS,
objFirstNameS, objLastNameS, objStatusS As OleDbParameter

objTitleG = cmd.Parameters.Add(strSalutation, OleDbType.VarChar)
objTitleG.Direction = ParameterDirection.Input
objTitleG.Value = txtTitle

objFirstNameG = cmd.Parameters.Add(strFirstName, OleDbType.VarChar)
objFirstNameG.Direction = ParameterDirection.Input
objFirstNameG.Value = txtFirstName

objLastNameG = cmd.Parameters.Add(strLastName, OleDbType.VarChar)
objLastNameG.Direction = ParameterDirection.Input
objLastNameG.Value = txtLastName

'objStatusG = cmd.Parameters.Add("????", OleDbType.VarChar)
'objStatusG.Direction = ParameterDirection.Input
'objStatusG.Value = fldRSVPg

objTitleS = cmd.Parameters.Add(strSalutationS, OleDbType.VarChar)
objTitleS.Direction = ParameterDirection.Input
objTitleS.Value = txtTitleS

objFirstNameS = cmd.Parameters.Add(strFirstNameS, OleDbType.VarChar)
objFirstNameS.Direction = ParameterDirection.Input
objFirstNameS.Value = txtFirstNameS

objLastNameS = cmd.Parameters.Add(strLastNameS, OleDbType.VarChar)
objLastNameS.Direction = ParameterDirection.Input
objLastNameS.Value = txtLastnameS

'objStatusS = cmd.Parameters.Add("????", OleDbType.VarChar)
'objStatusS.Direction = ParameterDirection.Input
'objStatusS.Value = fldRSVPs

Dim myReader As OleDbDataReader = cmd.ExecuteReader
myReader.Read()

myReader.Close()
' Catch ex As Exception
' lblMessage.Visible = True
' lblMessage.Text = "Error: Data could not be updated. Please
contact your systems administrator if this error persists..."
' Finally
objConn.Close()
' End Try

End Sub
Jun 6 '06 #1
0 864

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bill Cart | last post by:
This is a question from a confused newbe.I have an oldDbCommand component called oleDbCmdAddDemoReq and an oldDbConnection called oleDbConDemoReq on a web form. I have the following code: ...
4
by: charleswesley | last post by:
I think the problem is with the strPrice variable in the AddToCart() sub. I've been messing with it all morning and can't seem to figure it out. Any ideas? ...
1
by: Bruce A. Julseth | last post by:
I am getting an error message on .ExecuteNonQuery using a procedure stating the I need to use IConvertible. The data the gives the error is a defined as "SqlDbType.Money." When I search...
2
by: lcorrias | last post by:
i try to do a simple insert using SQLDataSource and a Stored Procedure I try all night and always have this error Object Must Implement IConvertible
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.