Click here to Skip to main content
15,892,298 members
Home / Discussions / C#
   

C#

 
GeneralRe: C#/SQL Question Pin
Colin Angus Mackay7-Jun-06 9:03
Colin Angus Mackay7-Jun-06 9:03 
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 
Basically my code is missing a step. Right now the user enters the Part Number (Parts.PartNumber which is a varchar). Right now the code says, okay give me info from costs where Costs.PartID matches Parts.PartNumber. But it's never going to match up because I missed a step.

For example, product C15690 has an ID of 5499. This is what I need to match.

Right now the code goes like this....
Costs.PartID = Parts.PartNumber

Should be...
First get Parts.ID based on Parts.PartNumber (missing step)
Costs.PartID = Parts.ID

private void btnSearchPartNumber_Click(object sender, System.EventArgs e)<br />
		{<br />
			strPartNumberInput = txtPartNumber.Text;<br />
			int partNumber = Convert.ToInt32(strPartNumberInput);//THIS IS WRONG. First, partNumber is a varchar so can get rid of this. But need the Parts.ID which is a number.<br />
			string SQLString = "Select * FROM Costs where Costs.PartID = @PartID"; <br />
			SqlCommand cmd = new SqlCommand();<br />
			cmd.Connection = new SqlConnection(strConnectSQL);<br />
			cmd.CommandText = SQLString;<br />
			cmd.Parameters.Add ("@PartID", partNumber);<br />
			BindGrid (strConnectSQL, SQLString, DataGrid1 );<br />
		}


Oh, I hope this explains it!
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 
AnswerRe: Calling identically named properties Pin
Wjousts7-Jun-06 6:52
Wjousts7-Jun-06 6:52 
GeneralRe: Calling identically named properties Pin
MartinSmith7-Jun-06 6:57
MartinSmith7-Jun-06 6:57 
QuestionDesigning HTTP Handler Pin
Raghu Deshpande7-Jun-06 6:14
Raghu Deshpande7-Jun-06 6:14 
QuestionRemoving / Adding HTTP/1.1 headers to HTTPWebRequest object Pin
Raghu Deshpande7-Jun-06 6:12
Raghu Deshpande7-Jun-06 6:12 
QuestionBulk updation thousands of records [modified] Pin
May i help you Munus7-Jun-06 5:49
May i help you Munus7-Jun-06 5:49 
Questionpassing an object Pin
rcwoods7-Jun-06 5:30
rcwoods7-Jun-06 5:30 
AnswerRe: passing an object Pin
User 66587-Jun-06 5:36
User 66587-Jun-06 5:36 

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.