Click to See Complete Forum and Search --> : Email Address Text String Problem


twick10
April 3rd, 2003, 08:59 AM
Hi,

I am having a problem storing an Email Address in an SQL database using .net (ASP). I think the problem is in .net.

I run a storred procedure by passing parameters.
Some code:

SqlCommand1.Parameters("@Email").Value = Str(htxtEmail.Value)
SqlCommand1.Parameters("@UserID").Value = CStr(txtUserID.Value)
SqlCommand1.Parameters("@Password").Value = Password1.Value
SqlCommand1.Parameters("@FName").Value = FName.Value
SqlCommand1.Parameters("@LName").Value = LName.Value
SqlCommand1.Parameters("@Zip").Value = Zip.Value SqlCommand1.Parameters("@CountryCode").Value = RTrim(ddlCountry.SelectedItem.Value)

SqlCommand1.ExecuteScalar()

If I enter an Email Address such as tw@as.com I get this error: "Input string was not in a correct format." I think .net is interpetting a small Email address as a number somehow.

I have tried many dtring conversions and changes to Parameter collections but no help.

The Stack Trace is attached in case somebody knows how to interpet it.

Anybody have any ideas????

DSJ
April 3rd, 2003, 02:39 PM
Try htxtEmail.Text instead of htxtEmail.Value

twick10
April 4th, 2003, 07:22 AM
Thanks for the reply.

I am currently using a html input box (run at server) which has only the "value" property. I have also tried the asp textbox with the "text" property but got the same result as before.

Any other ideas out there???

gknierim
April 4th, 2003, 09:31 AM
What datatype are you declaring your parameters as?

Post your code where you are creating your parameters
For example:


Dim cmd As SqlClient.SqlCommand
With cmd.Parameters
.Add("@Param1", DbType.String)
End With

twick10
April 4th, 2003, 01:50 PM
Hi,

I am using the Colletion Property in SqlCommand for setting parameter types. My settings are:

@Email Properties:
Direction = Input
Precision = 0
Scale = 0
Size = 75
Source Column = "blank"
Source Version = Current
SqlDbType = Char
Value = "blank"

I have also tried SqlDbType = VarChar and = Text