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

Server Error Understanding

Please help me understand this Error???

Server Error in '/solo' Application.
----------------------------------------------------------------------------
----

Object must implement IConvertible.
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.InvalidCastException: Object must implement
IConvertible.

Source Error:

Line 509: Me.cmdAddMember.Parameters(30).Value =
Me.txtCurrentDate.Text
Line 510: Me.cmdAddMember.Connection.Open()
Line 511: Me.cmdAddMember.ExecuteNonQuery()
Line 512: Me.cmdAddMember.Connection.Close()
Line 513: Me.txtMemberId.Visible = True

Source File: c:\inetpub\wwwroot\solo\reg\index.aspx.vb Line: 511

Stack Trace:

[InvalidCastException: Object must implement IConvertible.]
System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +723
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +196
solo.index.btSubmit_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\solo\reg\index.aspx.vb:511
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo
stBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277

----------------------------------------------------------------------------
----

Nov 17 '05 #1
2 1927
What is the data type for parameter 30? datetime? In that case, try:

cmdAddMember.Parameters(30).Value = DateTime.Parse(txtCurrentDate.Text)
--
John Saunders
Internet Engineer
jo***********@surfcontrol.com

BTW, notice that you don't have to say "Me.".

"Leon Shaw" <vn*****@msn.com> wrote in message
news:ed**************@TK2MSFTNGP09.phx.gbl...
Please help me understand this Error???

Server Error in '/solo' Application.
-------------------------------------------------------------------------- -- ----

Object must implement IConvertible.
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.InvalidCastException: Object must implement
IConvertible.

Source Error:

Line 509: Me.cmdAddMember.Parameters(30).Value =
Me.txtCurrentDate.Text
Line 510: Me.cmdAddMember.Connection.Open()
Line 511: Me.cmdAddMember.ExecuteNonQuery()
Line 512: Me.cmdAddMember.Connection.Close()
Line 513: Me.txtMemberId.Visible = True

Source File: c:\inetpub\wwwroot\solo\reg\index.aspx.vb Line: 511

Stack Trace:

[InvalidCastException: Object must implement IConvertible.]
System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +723
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +196
solo.index.btSubmit_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\solo\reg\index.aspx.vb:511
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo stBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277

-------------------------------------------------------------------------- -- ----

Nov 17 '05 #2
Yes. The problem is that you're supplying strings to your smalldatetime
parameters. You need to use cmdAddMember.Parameter(n).Value =
DateTime.Parse(whatever.Text).

Once you get that working, I'd also recommend that you stop using numeric
indexes for the parameters. What happens to your code if the order of the
parameters changes? Try cmdAddMember.Parameter("@RenewalDate").Value
instead.

--
John Saunders
Internet Engineer
jo***********@surfcontrol.com

P.S. Don't you get tired of typing "Me." all the time?
"Leon Shaw" <vn*****@msn.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
(Do You See A Problem!) This is the Store Proceduce I'm using.

REATE PROCEDURE [Add_Member]
(@Username [varchar](20),
@Password [varchar](16),
@SecretQuestion [varchar](50),
@SecretAnswer [varchar](64),
@FirstName [varchar](64),
@LastName [varchar](64),
@BirthMonth [varchar](10),
@BirthDay [tinyint],
@BirthYear [smallint],
@Gender [varchar](6),
@SchoolState [varchar](50),
@SchoolName [varchar](200),
@Classification [varchar](50),
@Major [varchar](120),
@CreditCardName [varchar](120),
@CreditCardType [varchar](20),
@CreditCardNumber [varchar](16),
@CreditCardExpMonth [varchar](10),
@CreditCardExpYear [smallint],
@BillingAddress1 [varchar](200),
@BillingAddress2 [varchar](200),
@BillingCity [varchar](200),
@BillingState [varchar](50),
@BillingPostalCode [varchar](10),
@EmailAddress [varchar](64),
@PhoneAreaCode [char](3),
@PhoneNumber [varchar](8),
@ActivationDate [smalldatetime],
@RenewalDate [smalldatetime],
@LastUpdate [smalldatetime])

AS INSERT INTO [Stunation].[dbo].[TAB_Member]
( [Username],
[Password],
[SecretQuestion],
[SecretAnswer],
[FirstName],
[LastName],
[BirthMonth],
[BirthDay],
[BirthYear],
[Gender],
[SchoolState],
[SchoolName],
[Classification],
[Major],
[CreditCardName],
[CreditCardType],
[CreditCardNumber],
[CreditCardExpMonth],
[CreditCardExpYear],
[BillingAddress1],
[BillingAddress2],
[BillingCity],
[BillingState],
[BillingPostalCode],
[EmailAddress],
[PhoneAreaCode],
[PhoneNumber],
[ActivationDate],
[RenewalDate],
[LastUpdate])

VALUES
( @Username,
@Password,
@SecretQuestion,
@SecretAnswer,
@FirstName,
@LastName,
@BirthMonth,
@BirthDay,
@BirthYear,
@Gender,
@SchoolState,
@SchoolName,
@Classification,
@Major,
@CreditCardName,
@CreditCardType,
@CreditCardNumber,
@CreditCardExpMonth,
@CreditCardExpYear,
@BillingAddress1,
@BillingAddress2,
@BillingCity,
@BillingState,
@BillingPostalCode,
@EmailAddress,
@PhoneAreaCode,
@PhoneNumber,
@ActivationDate,
@RenewalDate,
@LastUpdate)

SELECT MemberID = @@IDENTITY
GO
This is the code inside of vs.net
If Me.IsValid = True Then

Me.txtMemberId.Text = Me.cmdAddMember.Parameters(0).Value

Me.cmdAddMember.Parameters(1).Value = Me.txtUsername.Text

Me.cmdAddMember.Parameters(2).Value = Me.txtPassword.Text

Me.cmdAddMember.Parameters(3).Value = Me.ddlSecretQuestion.SelectedItem

Me.cmdAddMember.Parameters(4).Value = Me.txtSecretAnswer.Text

Me.cmdAddMember.Parameters(5).Value = Me.txtFirstName.Text

Me.cmdAddMember.Parameters(6).Value = Me.txtLastName.Text

Me.cmdAddMember.Parameters(7).Value = Me.ddlBirthMonth.SelectedItem

Me.cmdAddMember.Parameters(8).Value = Me.ddlBirthDay.SelectedItem

Me.cmdAddMember.Parameters(9).Value = Me.txtBirthYear.Text

Me.cmdAddMember.Parameters(10).Value = Me.rbtGender.SelectedItem

Me.cmdAddMember.Parameters(11).Value = Me.ddlSchoolState.SelectedItem

Me.cmdAddMember.Parameters(12).Value = Me.ddlSchoolName.SelectedItem

Me.cmdAddMember.Parameters(13).Value = Me.ddlClassification.SelectedItem

Me.cmdAddMember.Parameters(14).Value = Me.ddlSchoolMajor.SelectedItem

Me.cmdAddMember.Parameters(15).Value = Me.txtCreditCardName.Text

Me.cmdAddMember.Parameters(16).Value = Me.ddlCreditCardType.SelectedItem

Me.cmdAddMember.Parameters(17).Value = Me.txtCreditCardNumber.Text

Me.cmdAddMember.Parameters(18).Value = Me.ddlExpMonth.SelectedItem

Me.cmdAddMember.Parameters(19).Value = Me.ddlExpYear.SelectedItem

Me.cmdAddMember.Parameters(20).Value = Me.txtBillingAddress1.Text

Me.cmdAddMember.Parameters(21).Value = Me.txtBillingAddress2.Text

Me.cmdAddMember.Parameters(22).Value = Me.txtBillingCity.Text

Me.cmdAddMember.Parameters(23).Value = Me.ddlBillingState.SelectedItem

Me.cmdAddMember.Parameters(24).Value = Me.txtBillingZipCode.Text

Me.cmdAddMember.Parameters(25).Value = Me.txtEmail.Text

Me.cmdAddMember.Parameters(26).Value = Me.txtPhonerAreaCode.Text

Me.cmdAddMember.Parameters(27).Value = Me.txtPhone.Text

Me.cmdAddMember.Parameters(28).Value = Me.txtCurrentDate.Text

Me.cmdAddMember.Parameters(29).Value = (Me.txtFutureDate.Text)

Me.cmdAddMember.Parameters(30).Value = (Me.txtCurrentDate.Text)

Me.cmdAddMember.Connection.Open()

Me.cmdAddMember.ExecuteNonQuery()

Me.cmdAddMember.Connection.Close()

Me.txtMemberId.Visible = True

End If

"John Saunders" <jo***********@surfcontrol.com> wrote in message
news:O1**************@TK2MSFTNGP09.phx.gbl...
What is the data type for parameter 30? datetime? In that case, try:

cmdAddMember.Parameters(30).Value = DateTime.Parse(txtCurrentDate.Text)
--
John Saunders
Internet Engineer
jo***********@surfcontrol.com

BTW, notice that you don't have to say "Me.".

"Leon Shaw" <vn*****@msn.com> wrote in message
news:ed**************@TK2MSFTNGP09.phx.gbl...
Please help me understand this Error???

Server Error in '/solo' Application.


--------------------------------------------------------------------------
--
----

Object must implement IConvertible.
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.InvalidCastException: Object must implement
IConvertible.

Source Error:

Line 509: Me.cmdAddMember.Parameters(30).Value =
Me.txtCurrentDate.Text
Line 510: Me.cmdAddMember.Connection.Open()
Line 511: Me.cmdAddMember.ExecuteNonQuery()
Line 512: Me.cmdAddMember.Connection.Close()
Line 513: Me.txtMemberId.Visible = True

Source File: c:\inetpub\wwwroot\solo\reg\index.aspx.vb Line: 511

Stack Trace:

[InvalidCastException: Object must implement IConvertible.]
System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +723
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +196
solo.index.btSubmit_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\solo\reg\index.aspx.vb:511
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo
stBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33 System.Web.UI.Page.ProcessRequestMain() +1277


--------------------------------------------------------------------------
--
----



Nov 17 '05 #3

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

Similar topics

1
by: Jon LaRosa | last post by:
Hi all - I have a web application and I want to be able to do some basic error handling. For example, here is one error I would like to catch and display in a useful way for the user: ...
6
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
4
by: jf li | last post by:
I have a Asp.net web application and a Asp.net Web service application. The Web application is using HtmlInputFile to get a 50M size of file selected by end user, read the data of this file and...
7
by: Anil | last post by:
I have a Javascript program which runs in the browser and has functions work(), and stop(). It listens to commands from the server to work() and can be interrupted by the server to stop(). I am...
4
by: PALLAVI SHARMA | last post by:
I have made a web site using asp.net and c#. I used ms access for database, but i have problem that i don't know how to upload my ms access database on web server. I have domain name and password,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.