473,657 Members | 2,585 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

stored procedure

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_QuestionAuth ors

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

@RPQ,@skills)
GO

am calling this stroed procedure in

asp.net like this


Dim cmdQAinsert As New OleDbCommand
cmdQAinsert.Con nection = MyConn
cmdQAinsert.Tra nsaction = t
cmdQAinsert.Com mandType = commandType.Sto redProcedure
cmdQAinsert.Com mandText = "QA_Insert_ QA"

Dim comments As New OleDb.OleDbPara meter
comments.OleDbT ype = OleDbType.VarCh ar
comments.Direct ion = ParameterDirect ion.Input
comments.Value = Trim(txtComment s.Text)

Dim email1 As New OleDb.OleDbPara meter
email1.OleDbTyp e = OleDbType.VarCh ar
email1.Directio n = ParameterDirect ion.Input
email1.Value = Trim(txtEmail.T ext)

Dim pwd As New OleDb.OleDbPara meter
pwd.OleDbType = OleDbType.VarCh ar
pwd.Direction = ParameterDirect ion.Input
pwd.Value = pwdgen.pwdgen.R andomString()

Dim PayPalAcc As New OleDb.OleDbPara meter
PayPalAcc.OleDb Type = OleDbType.VarCh ar
PayPalAcc.Direc tion = ParameterDirect ion.Input
PayPalAcc.Value = Trim(txtPayPalA cc.Text)

Dim RatePerQues As New
OleDb.OleDbPara meter
RatePerQues.Ole DbType = OleDbType.VarCh ar
RatePerQues.Dir ection = ParameterDirect ion.Input
RatePerQues.Val ue =
Trim(txtRatePer Question.Text)

Dim skills As New OleDb.OleDbPara meter
skills.OleDbTyp e = OleDbType.Varia nt
skills.Directio n = ParameterDirect ion.Input
skills.Value = Trim(ddlSkills. SelectedValue)

cmdQAinsert.Par ameters.Add(ema il1)
cmdQAinsert.Par ameters.Add(pwd )
cmdQAinsert.Par ameters.Add(com ments)
cmdQAinsert.Par ameters.Add(Pay PalAcc)
cmdQAinsert.Par ameters.Add(Rat ePerQues
)
cmdQAinsert.Par ameters.Add(ski lls)
res = cmdQAinsert.Exe cuteNonQuery()
-----
----

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
Nov 19 '05 #1
1 1522
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_QuestionAuth ors

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

@RPQ,@skills)
GO

am calling this stroed procedure in

asp.net like this


Dim cmdQAinsert As New OleDbCommand
cmdQAinsert.Con nection = MyConn
cmdQAinsert.Tra nsaction = t
cmdQAinsert.Com mandType = commandType.Sto redProcedure
cmdQAinsert.Com mandText = "QA_Insert_ QA"

Dim comments As New OleDb.OleDbPara meter
comments.OleDbT ype = OleDbType.VarCh ar
comments.Direct ion = ParameterDirect ion.Input
comments.Value = Trim(txtComment s.Text)

Dim email1 As New OleDb.OleDbPara meter
email1.OleDbTyp e = OleDbType.VarCh ar
email1.Directio n = ParameterDirect ion.Input
email1.Value = Trim(txtEmail.T ext)

Dim pwd As New OleDb.OleDbPara meter
pwd.OleDbType = OleDbType.VarCh ar
pwd.Direction = ParameterDirect ion.Input
pwd.Value = pwdgen.pwdgen.R andomString()

Dim PayPalAcc As New OleDb.OleDbPara meter
PayPalAcc.OleDb Type = OleDbType.VarCh ar
PayPalAcc.Direc tion = ParameterDirect ion.Input
PayPalAcc.Value = Trim(txtPayPalA cc.Text)

Dim RatePerQues As New
OleDb.OleDbPara meter
RatePerQues.Ole DbType = OleDbType.VarCh ar
RatePerQues.Dir ection = ParameterDirect ion.Input
RatePerQues.Val ue =
Trim(txtRatePer Question.Text)

Dim skills As New OleDb.OleDbPara meter
skills.OleDbTyp e = OleDbType.Varia nt
skills.Directio n = ParameterDirect ion.Input
skills.Value = Trim(ddlSkills. SelectedValue)

cmdQAinsert.Par ameters.Add(ema il1)
cmdQAinsert.Par ameters.Add(pwd )
cmdQAinsert.Par ameters.Add(com ments)
cmdQAinsert.Par ameters.Add(Pay PalAcc)
cmdQAinsert.Par ameters.Add(Rat ePerQues
)
cmdQAinsert.Par ameters.Add(ski lls)
res = cmdQAinsert.Exe cuteNonQuery()
-----
----

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

Nov 19 '05 #2

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

Similar topics

3
22128
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 application server can talk to the database. I've determined the failure occurs when the the following statement is executed: cstmt.execute(); (due to the failure of println statements placed afterwards). I get the following error after trying to...
0
6693
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 Visual Basic .NET version of this article, see 308049. For a Microsoft Visual C++ .NET version of this article, see 310071. For a Microsoft Visual J# .NET version of this article, see 320627. This article refers to the following Microsoft .NET...
3
2800
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" when I launched the IBM Distributed Debugger via D:\IBMDebug>idebug.exe -qdaemon -quiport=8000,8001 First, a bit of background. I am running DB2 V7.2 with Fixpack 9 applied on Windows XP Professional (all critical service applied). I've written...
4
3185
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 Throwable as an OUT parameter and what datatype should I use in the CREATE PROCEDURE and DROP PROCEDURE statements? Here's what I tried: - the method signature for the stored procedure included: Throwable throwable
8
7933
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 created a temporary database with a tables space. Verified that DECLARE GLOBAL TEMPORARY TABLE TEMP (A INTEGER); INSERT INTO SESSION.TEMP VALUES(10); SELECT A FROM SESSION.TEMP; works from a query tool.
2
5450
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
0
2642
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 to call them from an ASP.Net page Every modern database system has a stored procedure language. SQL Server is no different and has a relatively sophisticated and easy to use system. This article will not attempt to go into depth in explaining...
3
3473
by: kd | last post by:
Hi All, How to debug a stored procedure? Thanks, kd
7
3451
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 'UpdateRegistrant' expects parameter '@EMail', which was not supplied. The field value was null in the database and not changed in the FormView so is null going back into the stored procedure. I'm stumped and would greatly appreciate any suggestions.
2
4100
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
0
8397
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8310
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7333
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6167
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1620
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.