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 1 1512
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: dinesh prasad |
last post by:
I'm trying to use a servlet to process a form, then send that data to
an SQL server stored procedure. I'm using the WebLogic 8 App. server.
I am able to retrieve database information, so I know my...
|
by: Nashat Wanly |
last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and
Visual C# .NET
View products that this article applies to.
This article was previously published under Q310070
For a Microsoft...
|
by: Rhino |
last post by:
I've spent the last couple of hours trying to figure out how to debug a Java
stored procedure and am just going in circles. The last straw came when I
got "Cannot open input stream for default"...
|
by: Rhino |
last post by:
Is it possible for a Java Stored Procedure in DB2 V7.2 (Windows) to pass a
Throwable back to the calling program as an OUT parameter?
If yes, what datatype should I use when registering the...
|
by: Thomasb |
last post by:
With a background in MS SQL Server programming I'm used to temporary
tables. Have just started to work with DB2 ver 7 on z/OS and stumbled
into the concept of GLOBAL TEMPORARY TABLE.
I have...
|
by: Dino L. |
last post by:
How can I run stored procedure (MSSQL) ?
|
by: Amber |
last post by:
Stored procedures are faster and more efficient than in-line SQL
statements. In this article we will look at two SQL Server stored
procedures; one using an input parameter and one not, and see how...
|
by: kd |
last post by:
Hi All,
How to debug a stored procedure?
Thanks,
kd
|
by: Dabbler |
last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the
following error when trying to update (ExecuteNonQuery):
System.Data.SqlClient.SqlException: Procedure or Function...
|
by: jed |
last post by:
I have created this example in sqlexpress
ALTER PROCEDURE .
@annualtax FLOAT
AS
BEGIN
SELECT begin1,end1,deductedamount,pecentageextra
FROM tax
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
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
|
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...
|
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...
| |