Click here to Skip to main content
15,908,673 members
Home / Discussions / C#
   

C#

 
GeneralRe: Problem with code returning parameter from stored procedure Pin
leckey12-Jul-06 10:45
leckey12-Jul-06 10:45 
GeneralRe: Problem with code returning parameter from stored procedure Pin
leckey12-Jul-06 10:44
leckey12-Jul-06 10:44 
GeneralRe: Problem with code returning parameter from stored procedure Pin
Christian Graus12-Jul-06 10:48
protectorChristian Graus12-Jul-06 10:48 
GeneralRe: Problem with code returning parameter from stored procedure Pin
leckey12-Jul-06 10:50
leckey12-Jul-06 10:50 
GeneralRe: Problem with code returning parameter from stored procedure Pin
Christian Graus12-Jul-06 10:58
protectorChristian Graus12-Jul-06 10:58 
GeneralRe: Problem with code returning parameter from stored procedure Pin
leckey12-Jul-06 11:02
leckey12-Jul-06 11:02 
GeneralRe: Problem with code returning parameter from stored procedure Pin
Christian Graus12-Jul-06 11:09
protectorChristian Graus12-Jul-06 11:09 
GeneralRe: Problem with code returning parameter from stored procedure Pin
leckey12-Jul-06 11:15
leckey12-Jul-06 11:15 
Okay, question time!
I have my connection in my web.config file and have this declared in my code behind:
private string connectionString = ConfigurationSettings.AppSettings["connectionString"].ToString();

So I changed my code to:
private object btnAdd_Click(object sender, System.EventArgs e)<br />
		{<br />
			strPartNumberInputReference = txtSearchPart.Text;<br />
			strPartTypeID = ddPartType.SelectedValue;<br />
			SqlCommand cmd = new SqlCommand ("UpdatePart_Step_1_Test3", connectionString);<br />
			cmd.CommandType = CommandType.StoredProcedure;<br />
			cmd.Parameters.Add ("@PartNumber", strPartNumberInputReference);<br />
			cmd.Parameters.Add ("@PartTypeValue", strPartTypeID);<br />
			cmd.Parameters.Add("@ID",SqlDbType.Int);<br />
			cmd.Parameters["@ID"].Direction = ParameterDirection.Output;<br />
			cmd.ExecuteNonQuery();<br />
			return(int) cmd.Parameters["@ID"].Value;<br />
		}


Problem 1: I bolded "connectionString"--the compiler is unhappy and not sure how to resolve this. Geting "cannot convert string..." so I assume I need to change the declaration...but what to?
GeneralRe: Problem with code returning parameter from stored procedure Pin
Christian Graus12-Jul-06 11:17
protectorChristian Graus12-Jul-06 11:17 
GeneralRe: Problem with code returning parameter from stored procedure Pin
Christian Graus12-Jul-06 11:09
protectorChristian Graus12-Jul-06 11:09 
AnswerRe: Problem with code returning parameter from stored procedure [modified] Pin
Jon Sagara12-Jul-06 11:14
Jon Sagara12-Jul-06 11:14 
GeneralRe: Problem with code returning parameter from stored procedure Pin
leckey12-Jul-06 11:24
leckey12-Jul-06 11:24 
GeneralRe: Problem with code returning parameter from stored procedure Pin
Christian Graus12-Jul-06 11:36
protectorChristian Graus12-Jul-06 11:36 
GeneralRe: Problem with code returning parameter from stored procedure Pin
leckey12-Jul-06 11:50
leckey12-Jul-06 11:50 
Questionreturn code from console application Pin
Petes197312-Jul-06 9:45
Petes197312-Jul-06 9:45 
AnswerRe: return code from console application Pin
led mike12-Jul-06 9:56
led mike12-Jul-06 9:56 
GeneralRe: return code from console application Pin
Petes197312-Jul-06 10:02
Petes197312-Jul-06 10:02 
GeneralRe: return code from console application Pin
led mike12-Jul-06 10:17
led mike12-Jul-06 10:17 
GeneralRe: return code from console application Pin
Petes197312-Jul-06 10:30
Petes197312-Jul-06 10:30 
QuestionDisplaying Calculation results. [modified] Pin
Skanless12-Jul-06 9:42
Skanless12-Jul-06 9:42 
AnswerRe: Displaying Calculation results. Pin
Guffa12-Jul-06 12:32
Guffa12-Jul-06 12:32 
QuestionDifference between Thread.Start() and Delegate.BeginInvoke() Pin
zaboboa12-Jul-06 9:40
zaboboa12-Jul-06 9:40 
AnswerRe: Difference between Thread.Start() and Delegate.BeginInvoke() Pin
Josh Smith12-Jul-06 9:55
Josh Smith12-Jul-06 9:55 
GeneralRe: Difference between Thread.Start() and Delegate.BeginInvoke() [modified] Pin
zaboboa12-Jul-06 10:00
zaboboa12-Jul-06 10:00 
GeneralRe: Difference between Thread.Start() and Delegate.BeginInvoke() Pin
Josh Smith12-Jul-06 10:12
Josh Smith12-Jul-06 10:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.