Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > stored procedure

Reply
Thread Tools

stored procedure

 
 
Yoshitha
Guest
Posts: n/a
 
      02-22-2005
Hi
i've created one table and one stroed procedure to insert data into that
table.
i've created table like this

table Name=QA_QAuthor

EmailId Varchar primarykey.
Pwd varchar
Comments varchar allows null values
paypalacc varchar allows null values
rateperqueston numeric allows null values
Skills varchar


Stroed Procedure


CREATE PROCEDURE QA_Insert_QA
@email varchar(50),
@pwd varchar(50),
@comments varchar(50),
@paypal varchar(50),
@RPQ numeric,
@skills varchar(50)
AS
insert into QA_QuestionAuthors

values(@email,@pwd,@comments,@paypal,

@RPQ,@skills)
GO

am calling this stroed procedure in

asp.net like this




Dim cmdQAinsert As New OleDbCommand
cmdQAinsert.Connection = MyConn
cmdQAinsert.Transaction = t
cmdQAinsert.CommandType = commandType.StoredProcedure
cmdQAinsert.CommandText = "QA_Insert_QA"

Dim comments As New OleDb.OleDbParameter
comments.OleDbType = OleDbType.VarChar
comments.Direction = ParameterDirection.Input
comments.Value = Trim(txtComments.Text)

Dim email1 As New OleDb.OleDbParameter
email1.OleDbType = OleDbType.VarChar
email1.Direction = ParameterDirection.Input
email1.Value = Trim(txtEmail.Text)

Dim pwd As New OleDb.OleDbParameter
pwd.OleDbType = OleDbType.VarChar
pwd.Direction = ParameterDirection.Input
pwd.Value = pwdgen.pwdgen.RandomString()

Dim PayPalAcc As New OleDb.OleDbParameter
PayPalAcc.OleDbType = OleDbType.VarChar
PayPalAcc.Direction = ParameterDirection.Input
PayPalAcc.Value = Trim(txtPayPalAcc.Text)

Dim RatePerQues As New
OleDb.OleDbParameter
RatePerQues.OleDbType = OleDbType.VarChar
RatePerQues.Direction = ParameterDirection.Input
RatePerQues.Value =
Trim(txtRatePerQuestion.Text)

Dim skills As New OleDb.OleDbParameter
skills.OleDbType = OleDbType.Variant
skills.Direction = ParameterDirection.Input
skills.Value = Trim(ddlSkills.SelectedValue)



cmdQAinsert.Parameters.Add(email1)
cmdQAinsert.Parameters.Add(pwd)
cmdQAinsert.Parameters.Add(comments)
cmdQAinsert.Parameters.Add(PayPalAcc)
cmdQAinsert.Parameters.Add(RatePerQues
)
cmdQAinsert.Parameters.Add(skills)
res = cmdQAinsert.ExecuteNonQuery()


-----
----

if i entering data for all fields

then it is not giving any exception ,

the data is storing in backend table.
but when i enter data for few fields

and when am trying to run the

application then it is rising the following exception

"Input String is not in a correct format"

why am getting this error.
in the table i set allow null for 3

fields and for these 3 fields if i wont specify any data then it is giving
that exception if i specify data for these fields then am not getting any
errors.

can u tell how to solve this problem?

Thanx in advance
Yoshitha


 
Reply With Quote
 
 
 
 
=?Utf-8?B?c2FyYQ==?=
Guest
Posts: n/a
 
      02-22-2005
Hi Yoshitha
if u let say a textbox empty and in ur procedure u parse it to integer or
float or any thing other than string this execption apper
to do that make a condation that when there is null entry u pass to ur
procedure 0 for int not null
Hope this help

"Yoshitha" wrote:

> Hi
> i've created one table and one stroed procedure to insert data into that
> table.
> i've created table like this
>
> table Name=QA_QAuthor
>
> EmailId Varchar primarykey.
> Pwd varchar
> Comments varchar allows null values
> paypalacc varchar allows null values
> rateperqueston numeric allows null values
> Skills varchar
>
>
> Stroed Procedure
>
>
> CREATE PROCEDURE QA_Insert_QA
> @email varchar(50),
> @pwd varchar(50),
> @comments varchar(50),
> @paypal varchar(50),
> @RPQ numeric,
> @skills varchar(50)
> AS
> insert into QA_QuestionAuthors
>
> values(@email,@pwd,@comments,@paypal,
>
> @RPQ,@skills)
> GO
>
> am calling this stroed procedure in
>
> asp.net like this
>
>
>
>
> Dim cmdQAinsert As New OleDbCommand
> cmdQAinsert.Connection = MyConn
> cmdQAinsert.Transaction = t
> cmdQAinsert.CommandType = commandType.StoredProcedure
> cmdQAinsert.CommandText = "QA_Insert_QA"
>
> Dim comments As New OleDb.OleDbParameter
> comments.OleDbType = OleDbType.VarChar
> comments.Direction = ParameterDirection.Input
> comments.Value = Trim(txtComments.Text)
>
> Dim email1 As New OleDb.OleDbParameter
> email1.OleDbType = OleDbType.VarChar
> email1.Direction = ParameterDirection.Input
> email1.Value = Trim(txtEmail.Text)
>
> Dim pwd As New OleDb.OleDbParameter
> pwd.OleDbType = OleDbType.VarChar
> pwd.Direction = ParameterDirection.Input
> pwd.Value = pwdgen.pwdgen.RandomString()
>
> Dim PayPalAcc As New OleDb.OleDbParameter
> PayPalAcc.OleDbType = OleDbType.VarChar
> PayPalAcc.Direction = ParameterDirection.Input
> PayPalAcc.Value = Trim(txtPayPalAcc.Text)
>
> Dim RatePerQues As New
> OleDb.OleDbParameter
> RatePerQues.OleDbType = OleDbType.VarChar
> RatePerQues.Direction = ParameterDirection.Input
> RatePerQues.Value =
> Trim(txtRatePerQuestion.Text)
>
> Dim skills As New OleDb.OleDbParameter
> skills.OleDbType = OleDbType.Variant
> skills.Direction = ParameterDirection.Input
> skills.Value = Trim(ddlSkills.SelectedValue)
>
>
>
> cmdQAinsert.Parameters.Add(email1)
> cmdQAinsert.Parameters.Add(pwd)
> cmdQAinsert.Parameters.Add(comments)
> cmdQAinsert.Parameters.Add(PayPalAcc)
> cmdQAinsert.Parameters.Add(RatePerQues
> )
> cmdQAinsert.Parameters.Add(skills)
> res = cmdQAinsert.ExecuteNonQuery()
>
>
> -----
> ----
>
> if i entering data for all fields
>
> then it is not giving any exception ,
>
> the data is storing in backend table.
> but when i enter data for few fields
>
> and when am trying to run the
>
> application then it is rising the following exception
>
> "Input String is not in a correct format"
>
> why am getting this error.
> in the table i set allow null for 3
>
> fields and for these 3 fields if i wont specify any data then it is giving
> that exception if i specify data for these fields then am not getting any
> errors.
>
> can u tell how to solve this problem?
>
> Thanx in advance
> Yoshitha
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
procedure as argument in procedure AlexWare VHDL 2 10-23-2009 09:14 AM
'Procedure or function <stored procedure name> has too many arguments specified',,,ARGH! Mike P ASP .Net 0 06-19-2006 01:19 PM
Sending email through Stored procedure Patrick ASP .Net 2 02-15-2005 08:29 AM
How to modify default Stored Procedure template in VS.NET database project ES ASP .Net 2 08-20-2004 08:19 PM
New Stored Procedure Template in .Net Sarmad Aljazrawi ASP .Net 0 12-16-2003 11:36 AM



Advertisments