I see the Problem (really I do!), but I cannot seem to fix it. I know there
is not a value assign to username, but I don't know why. I change the code
like you said, I even explicitly set the (@Username) one time and still got
the same error. Take a deeper look Please! And Take for all the help!
'
'adptAddMember
'
Me.adptAddMember.InsertCommand = Me.SqlInsertCommand1
Me.adptAddMember.SelectCommand = Me.SqlSelectCommand1
Me.adptAddMember.TableMappings.AddRange(New
System.Data.Common.DataTableMapping() {New
System.Data.Common.DataTableMapping("Table", "Add_Member", New
System.Data.Common.DataColumnMapping() {New
System.Data.Common.DataColumnMapping("MemberID", "MemberID")})})
'
'SqlSelectCommand1
'
Me.SqlSelectCommand1.CommandText = "[Add_Member]"
Me.SqlSelectCommand1.CommandType = System.Data.CommandType.StoredProcedure
Me.SqlSelectCommand1.Connection = Me.connReg
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@RETURN_VALUE",
System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue,
False, CType(10, Byte), CType(0, Byte), "",
System.Data.DataRowVersion.Current, Nothing))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Username",
System.Data.SqlDbType.VarChar, 20))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Password",
System.Data.SqlDbType.VarChar, 16))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@SecretQuestion",
System.Data.SqlDbType.VarChar, 50))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@SecretAnswer",
System.Data.SqlDbType.VarChar, 64))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@FirstName",
System.Data.SqlDbType.VarChar, 64))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@LastName",
System.Data.SqlDbType.VarChar, 64))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@BirthMonth",
System.Data.SqlDbType.VarChar, 10))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@BirthDay",
System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input,
False, CType(3, Byte), CType(0, Byte), "",
System.Data.DataRowVersion.Current, Nothing))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@BirthYear",
System.Data.SqlDbType.SmallInt, 2, System.Data.ParameterDirection.Input,
False, CType(5, Byte), CType(0, Byte), "",
System.Data.DataRowVersion.Current, Nothing))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Gender", System.Data.SqlDbType.VarChar,
6))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@SchoolState",
System.Data.SqlDbType.VarChar, 50))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@SchoolName",
System.Data.SqlDbType.VarChar, 200))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Classification",
System.Data.SqlDbType.VarChar, 50))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Major", System.Data.SqlDbType.VarChar,
120))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@CreditCardName",
System.Data.SqlDbType.VarChar, 120))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@CreditCardType",
System.Data.SqlDbType.VarChar, 20))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@CreditCardNumber",
System.Data.SqlDbType.VarChar, 16))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@CreditCardExpMonth",
System.Data.SqlDbType.VarChar, 10))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@CreditCardExpYear",
System.Data.SqlDbType.SmallInt, 2, System.Data.ParameterDirection.Input,
False, CType(5, Byte), CType(0, Byte), "",
System.Data.DataRowVersion.Current, Nothing))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@BillingAddress1",
System.Data.SqlDbType.VarChar, 200))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@BillingAddress2",
System.Data.SqlDbType.VarChar, 200))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@BillingCity",
System.Data.SqlDbType.VarChar, 200))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@BillingState",
System.Data.SqlDbType.VarChar, 50))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@BillingPostalCode",
System.Data.SqlDbType.VarChar, 10))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@EmailAddress",
System.Data.SqlDbType.VarChar, 64))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@PhoneAreaCode",
System.Data.SqlDbType.VarChar, 3))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@PhoneNumber",
System.Data.SqlDbType.VarChar, 8))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@ActivationDate",
System.Data.SqlDbType.DateTime, 8))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@RenewalDate",
System.Data.SqlDbType.DateTime, 8))
Me.SqlSelectCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@LastUpdate",
System.Data.SqlDbType.DateTime, 8))
'
'SqlInsertCommand1
'
Me.SqlInsertCommand1.CommandText = "[Add_Member]"
Me.SqlInsertCommand1.CommandType = System.Data.CommandType.StoredProcedure
Me.SqlInsertCommand1.Connection = Me.connReg
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@RETURN_VALUE",
System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue,
False, CType(10, Byte), CType(0, Byte), "",
System.Data.DataRowVersion.Current, Nothing))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Username",
System.Data.SqlDbType.VarChar, 20))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Password",
System.Data.SqlDbType.VarChar, 16))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@SecretQuestion",
System.Data.SqlDbType.VarChar, 50))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@SecretAnswer",
System.Data.SqlDbType.VarChar, 64))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@FirstName",
System.Data.SqlDbType.VarChar, 64))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@LastName",
System.Data.SqlDbType.VarChar, 64))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@BirthMonth",
System.Data.SqlDbType.VarChar, 10))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@BirthDay",
System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input,
False, CType(3, Byte), CType(0, Byte), "",
System.Data.DataRowVersion.Current, Nothing))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@BirthYear",
System.Data.SqlDbType.SmallInt, 2, System.Data.ParameterDirection.Input,
False, CType(5, Byte), CType(0, Byte), "",
System.Data.DataRowVersion.Current, Nothing))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Gender", System.Data.SqlDbType.VarChar,
6))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@SchoolState",
System.Data.SqlDbType.VarChar, 50))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@SchoolName",
System.Data.SqlDbType.VarChar, 200))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Classification",
System.Data.SqlDbType.VarChar, 50))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Major", System.Data.SqlDbType.VarChar,
120))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@CreditCardName",
System.Data.SqlDbType.VarChar, 120))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@CreditCardType",
System.Data.SqlDbType.VarChar, 20))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@CreditCardNumber",
System.Data.SqlDbType.VarChar, 16))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@CreditCardExpMonth",
System.Data.SqlDbType.VarChar, 10))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@CreditCardExpYear",
System.Data.SqlDbType.SmallInt, 2, System.Data.ParameterDirection.Input,
False, CType(5, Byte), CType(0, Byte), "",
System.Data.DataRowVersion.Current, Nothing))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@BillingAddress1",
System.Data.SqlDbType.VarChar, 200))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@BillingAddress2",
System.Data.SqlDbType.VarChar, 200))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@BillingCity",
System.Data.SqlDbType.VarChar, 200))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@BillingState",
System.Data.SqlDbType.VarChar, 50))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@BillingPostalCode",
System.Data.SqlDbType.VarChar, 10))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@EmailAddress",
System.Data.SqlDbType.VarChar, 64))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@PhoneAreaCode",
System.Data.SqlDbType.VarChar, 3))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@PhoneNumber",
System.Data.SqlDbType.VarChar, 8))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@ActivationDate",
System.Data.SqlDbType.DateTime, 8))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@RenewalDate",
System.Data.SqlDbType.DateTime, 8))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@LastUpdate",
System.Data.SqlDbType.DateTime, 8))
'
'dsAddMember
'
Me.dsAddMember.DataSetName = "dsAddMember"
Me.dsAddMember.Locale = New System.Globalization.CultureInfo("en-US")
Me.dsAddMember.Namespace = "
http://www.tempuri.org/dsAddMember.xsd"
CType(Me.dsClassification,
System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.dsCreditCard, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.dsDay, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.dsGender, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.dsMajor, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.dsMonth, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.dsMySchool, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.dsSecretQuestion,
System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.dsState, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.dsYear, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.dsAddMember, System.ComponentModel.ISupportInitialize).EndInit()
If Me.IsValid = True Then
Me.adptAddMember.InsertCommand.Parameters(0).Value = Me.txtUsername.Text
Me.adptAddMember.InsertCommand.Parameters(1).Value = Me.txtPassword.Text
Me.adptAddMember.InsertCommand.Parameters(2).Value =
Me.ddlSecretQuestion.SelectedItem
Me.adptAddMember.InsertCommand.Parameters(3).Value = Me.txtSecretAnswer.Text
Me.adptAddMember.InsertCommand.Parameters(4).Value = Me.txtFirstName.Text
Me.adptAddMember.InsertCommand.Parameters(5).Value = Me.txtLastName.Text
Me.adptAddMember.InsertCommand.Parameters(6).Value =
Me.ddlBirthMonth.SelectedItem
Me.adptAddMember.InsertCommand.Parameters(7).Value =
Me.ddlBirthDay.SelectedItem
Me.adptAddMember.InsertCommand.Parameters(8).Value = Me.txtBirthYear.Text
Me.adptAddMember.InsertCommand.Parameters(9).Value =
Me.rbtGender.SelectedItem
Me.adptAddMember.InsertCommand.Parameters(10).Value =
Me.ddlSchoolState.SelectedItem
Me.adptAddMember.InsertCommand.Parameters(11).Value =
Me.ddlSchoolName.SelectedItem
Me.adptAddMember.InsertCommand.Parameters(12).Value =
Me.ddlClassification.SelectedItem
Me.adptAddMember.InsertCommand.Parameters(13).Value =
Me.ddlSchoolMajor.SelectedItem
Me.adptAddMember.InsertCommand.Parameters(14).Value =
Me.txtCreditCardName.Text
Me.adptAddMember.InsertCommand.Parameters(15).Value =
Me.ddlCreditCardType.SelectedItem
Me.adptAddMember.InsertCommand.Parameters(16).Value =
Me.txtCreditCardNumber.Text
Me.adptAddMember.InsertCommand.Parameters(17).Value =
Me.ddlExpMonth.SelectedItem
Me.adptAddMember.InsertCommand.Parameters(18).Value =
Me.ddlExpYear.SelectedItem
Me.adptAddMember.InsertCommand.Parameters(19).Value =
Me.txtBillingAddress1.Text
Me.adptAddMember.InsertCommand.Parameters(20).Value =
Me.txtBillingAddress2.Text
Me.adptAddMember.InsertCommand.Parameters(21).Value = Me.txtBillingCity.Text
Me.adptAddMember.InsertCommand.Parameters(22).Value =
Me.ddlBillingState.SelectedItem
Me.adptAddMember.InsertCommand.Parameters(23).Value =
Me.txtBillingZipCode.Text
Me.adptAddMember.InsertCommand.Parameters(24).Value = Me.txtEmail.Text
Me.adptAddMember.InsertCommand.Parameters(25).Value =
Me.txtPhonerAreaCode.Text
Me.adptAddMember.InsertCommand.Parameters(26).Value = Me.txtPhone.Text
Me.adptAddMember.InsertCommand.Parameters(27).Value = Me.txtCurrentDate.Text
Me.adptAddMember.InsertCommand.Parameters(28).Value = Me.txtFutureDate.Text
Me.adptAddMember.InsertCommand.Parameters(29).Value = Me.txtCurrentDate.Text
Me.adptAddMember.Fill(Me.dsAddMember)
Me.adptAddMember.Update(Me.dsAddMember)
End If
End Sub
William F. Robertson said:
The procedure looks good, but on your code ( codebehind) you were never
assigning anything to the username parameter that was being passed in.
Is that still the case?
bill
Leon Shaw said:
I Change my code, but I think something os wrong with my store procedure
because every where I test (query analyer, browers, vs.net server explorer)
it the following error show up:
Procedure 'Add_Member' expects parameter '@Username', which was not
supplied.
Do You see anything wrong?
CREATE 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
Have you changed any of your code or is it still the same?
bill
My Code is page is still giving me the same error, and can't figure-out
what
I'm doing wrong!
any suggestion?
Server Error in '/solo' Application.
--------------------------------------------------------------------------
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 508: Me.cmdAddMember.Parameters(30).Value =
Me.txtCurrentDate.Text
Line 509: Me.cmdAddMember.Connection.Open()
Line 510: Me.cmdAddMember.ExecuteNonQuery()
Line 511: Me.cmdAddMember.Connection.Close()
Line 512: Me.txtMemberId.Visible = True
Source File: c:\inetpub\wwwroot\solo\reg\index.aspx.vb Line: 510
Stack Trace:
[InvalidCastException: Object must implement IConvertible.]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +723
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +195
solo.index.btSubmit_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\solo\reg\index.aspx.vb:510
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePo
stBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+33
System.Web.UI.Page.ProcessRequestMain() +1277
--------------------------------------------------------------------------
--
----
Version Information: Microsoft .NET Framework Version:1.1.4322.573;
ASP.NET
Version:1.1.4322.573
This might have already been covered, but,
Me.txtMemberId.Text = Me.cmdAddMember.Parameters(0).Value
I know in C# the Parameters collection is 0 based, so I am
making
the
same
assumption for vb
Me.cmdAddMember.Parameters(1).Value = Me.txtUsername.Text.
This is the second parameter you have and is the first parameter
expected
by
the stored procedure, so it seems you are adding more parameters that
the
SP
knows what to do with.
You also can't grab the memberID until AFTER the query is run. You
can
either run the ExecuteScalar() to get the ID of the recently
added
and
you
will have to assign it after the query. Before the record is
inserted,
the
ID is not know.
You might want to get the @@Identity ( or rather the Scope_Identity()
<do
a
google search> ) as an output parameter.
HTH
bill
(Do You See A Problem!) This is the Store Proceduce and code 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
Leon,
It looks as if you need to convert the text into an actual date
object.
Me.cmdAddMember.Parameters(30).Value =
CType(Me.txtCurrentDate.Text,
DateTime)
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
Need help understanding?
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(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean
returnStream)
+723
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +195
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.IPostBackEventHandler.RaisePo