Click here to Skip to main content
15,897,891 members
Home / Discussions / C#
   

C#

 
GeneralRe: C#/SQL Question Pin
Colin Angus Mackay7-Jun-06 8:14
Colin Angus Mackay7-Jun-06 8:14 
AnswerRe: C#/SQL Question Pin
Colin Angus Mackay7-Jun-06 8:11
Colin Angus Mackay7-Jun-06 8:11 
QuestionRe: C#/SQL Question Pin
leckey7-Jun-06 8:15
leckey7-Jun-06 8:15 
AnswerRe: C#/SQL Question Pin
Colin Angus Mackay7-Jun-06 8:29
Colin Angus Mackay7-Jun-06 8:29 
GeneralRe: C#/SQL Question Pin
leckey7-Jun-06 8:36
leckey7-Jun-06 8:36 
GeneralRe: C#/SQL Question Pin
leckey7-Jun-06 8:55
leckey7-Jun-06 8:55 
GeneralRe: C#/SQL Question Pin
Josh Smith7-Jun-06 9:01
Josh Smith7-Jun-06 9:01 
GeneralRe: C#/SQL Question Pin
Colin Angus Mackay7-Jun-06 9:03
Colin Angus Mackay7-Jun-06 9:03 
Two changes:
the line:
Convert.ToInt32(strPartNumberInput);
becomes
int partNumber = Convert.ToInt32(strPartNumberInput);

And the line
cmd.Parameters.Add = ("@PartID", strPartNumberInput);
becomes
cmd.Parameters.Add("@PartID", partNumber);


leckey wrote:
BindGrid(strConnectSQL, SQLString, DataGrid1);


I'm not sure what that does (I'm guessing it is a method you created), but you need to send the command, not the string (remember the string now contains a parameter and the SQL Server needs to know what that means, which is what the cmd.Parameters.Add(...) does) And the method will have to be updated to use the command rather than the string.

I'm also guessing that strConnectSQL is your connection string - If so then you'll have to replace my reference to myConnection with your connection string.


"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)

My: Website | Blog
GeneralRe: C#/SQL Question Pin
leckey7-Jun-06 9:16
leckey7-Jun-06 9:16 
GeneralRe: C#/SQL Question Pin
Josh Smith7-Jun-06 9:29
Josh Smith7-Jun-06 9:29 
GeneralRe: C#/SQL Question Pin
leckey7-Jun-06 9:31
leckey7-Jun-06 9:31 
GeneralRe: C#/SQL Question [modified] Pin
Josh Smith7-Jun-06 9:38
Josh Smith7-Jun-06 9:38 
GeneralRe: C#/SQL Question--New Problem Pin
leckey7-Jun-06 9:47
leckey7-Jun-06 9:47 
GeneralRe: C#/SQL Question--New Problem Pin
Josh Smith7-Jun-06 9:51
Josh Smith7-Jun-06 9:51 
GeneralRe: C#/SQL Question--New Problem Pin
leckey7-Jun-06 9:58
leckey7-Jun-06 9:58 
GeneralRe: C#/SQL Question--New Problem Pin
Josh Smith7-Jun-06 10:12
Josh Smith7-Jun-06 10:12 
GeneralRe: C#/SQL Question--New Problem Pin
leckey7-Jun-06 10:20
leckey7-Jun-06 10:20 
GeneralRe: C#/SQL Question--New Problem Pin
Josh Smith7-Jun-06 10:38
Josh Smith7-Jun-06 10:38 
GeneralRe: C#/SQL Question--New Problem Pin
leckey7-Jun-06 10:44
leckey7-Jun-06 10:44 
GeneralRe: C#/SQL Question--New Problem Pin
Josh Smith7-Jun-06 10:54
Josh Smith7-Jun-06 10:54 
GeneralRe: C#/SQL Question Pin
Colin Angus Mackay7-Jun-06 12:23
Colin Angus Mackay7-Jun-06 12:23 
GeneralRe: C#/SQL Question Pin
leckey8-Jun-06 3:32
leckey8-Jun-06 3:32 
GeneralRe: C#/SQL Question Pin
Colin Angus Mackay8-Jun-06 8:28
Colin Angus Mackay8-Jun-06 8:28 
QuestionCalling identically named properties Pin
MartinSmith7-Jun-06 6:24
MartinSmith7-Jun-06 6:24 
AnswerRe: Calling identically named properties Pin
Dustin Metzgar7-Jun-06 6:48
Dustin Metzgar7-Jun-06 6:48 

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.