I have created and tested a stored procedure that works in sql. This stored procedure has one parameter that it requires to run "quoteno" . I already have the database attached to the form. Can anyone help me with the code for this. The name of my stored procedure is EstimateApproval and my database name is Estimator.
Thanks. Ive looked for answers on the net but not having any luck
MJV 0 Junior Poster in Training
Recommended Answers
Jump to PostThis is what i have tried. I get no errors but the database is not changing as per the stored procedure which does work when run within sql.
private void approveestBN_Click(object sender, EventArgs e) { int @estno; int.TryParse(startestnoCB.Text,out estno); SqlCommand cmd = new SqlCommand(); cmd.CommandText …
Jump to PostOkay, I see you are getting nowhere, so I will give you the code to do this:
private void DoSomething() { string ConnectionString = "Data Source={0};Initial Catalog={1};Integrated Security=True"; int estno; if( int.TryParse(startestnoCB.Text,out estno) ) { SqlConnection conn = new SqlConnection( string.Format(ConnectionString,".//SqlExpress" // Your Sql Server , "EstimateDataSet" …
Jump to PostNo you have have many connections.
Can you provide your exact connection string that you are using.// Jerry
Sorry for the delay, I tried sending you a reply hours ago from a different PC, but for whatever reason, it did not show up here.
Jump to PostAre talking about the @quotenum as an Sql Parameter to the stored procedure ?
…
The stored procedure must declare this as an OUTPUT parameter.
Then you set your SqlParameter Direction so that it also knows it is an OUTPUT type and will store the value in the parameter.Value upon return.
All 13 Replies
LizR 171 Posting Virtuoso
rapture 134 Posting Whiz in Training
MJV 0 Junior Poster in Training
MJV 0 Junior Poster in Training
rapture 134 Posting Whiz in Training
JerryShaw 46 Posting Pro in Training
MJV 0 Junior Poster in Training
MJV 0 Junior Poster in Training
JerryShaw 46 Posting Pro in Training
MJV 0 Junior Poster in Training
JerryShaw 46 Posting Pro in Training
MJV 0 Junior Poster in Training
JerryShaw 46 Posting Pro in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.