Click here to Skip to main content
15,916,189 members
Home / Discussions / C#
   

C#

 
AnswerRe: Delegates Pin
donkaiser16-Jun-06 18:58
donkaiser16-Jun-06 18:58 
Questionactive child container problem Pin
edel_ong16-Jun-06 16:43
edel_ong16-Jun-06 16:43 
QuestionStream Sound from Microphone [modified] Pin
surfman1916-Jun-06 12:40
surfman1916-Jun-06 12:40 
QuestionCOM interop and embedding Pin
therealmccoy16-Jun-06 11:41
therealmccoy16-Jun-06 11:41 
AnswerRe: COM interop and embedding Pin
mav.northwind16-Jun-06 12:22
mav.northwind16-Jun-06 12:22 
GeneralRe: COM interop and embedding Pin
therealmccoy16-Jun-06 20:04
therealmccoy16-Jun-06 20:04 
QuestionHelp Using Threading.Timer with FileSystemWatcher Pin
ddennison16-Jun-06 11:38
ddennison16-Jun-06 11:38 
QuestionAdding a blank row to a datagrid that uses multiple SQL tables Pin
leckey16-Jun-06 10:36
leckey16-Jun-06 10:36 
I am wanting to add a blank line to a datagrid so the user can enter new info. I found an example online (Newbie here!) that shows how to do it, but it only uses one table:
protected void dg_bind() {<br />
<br />
System.Data.SqlClient.SqlConnection SqlCon = new System.Data.SqlClient.SqlConnection( "server=localhost;database=northwind;trusted_connection=true;" );<br />
System.Data.SqlClient.SqlDataAdapter SqlDa = new System.Data.SqlClient.SqlDataAdapter( "SELECT TOP 10 ProductName FROM Products", SqlCon );<br />
ds = new System.Data.DataSet( );<br />
SqlDa.Fill( ds, "Products" );<br />
System.Data.DataRow BlankRow = ds.Tables[ "Products" ].NewRow( );<br />
BlankRow[ "ProductName" ] = "<font color=\"red\">add new product</font>";<br />
ds.Tables[ "Products" ].Rows.InsertAt( BlankRow, 0 );<br />
dg.DataSource = ds.Tables[ "Products" ];<br />
}


Currently my own BindData function looks like this:
private void BindData()<br />
		{<br />
			strPartNumberInputReference = txtPartNumberInput.Text;<br />
			string SQLString = "SELECT c.cost, pt.description, dd.DrawingNumber, dd.DrawingRevision, dd.DwgPath FROM costs c INNER JOIN Parts p ON c.PartID = p.Id INNER JOIN PartTypes pt on pt.ID = p.PartTypeID LEFT JOIN DraftingData dd on dd.PartID = p.ID  WHERE p.PartNumber = @PartID";<br />
			SqlCommand cmd = new SqlCommand();<br />
			cmd.Connection = new SqlConnection(strConnectSQL);<br />
			cmd.CommandText = SQLString;<br />
			cmd.Parameters.Add ("@PartID", strPartNumberInputReference);<br />
			SqlDataAdapter adapter = new SqlDataAdapter(cmd);<br />
			DataSet ds = new DataSet();<br />
			adapter.Fill(ds);<br />
			dgParts.DataSource = ds;<br />
			dgParts.DataBind();<br />
		}


How do I convert that first code that I bolded to work with my program and multiple tables?
Questionchange the name font when enter tab control Pin
donkaiser16-Jun-06 10:29
donkaiser16-Jun-06 10:29 
AnswerRe: change the name font when enter tab control Pin
Josh Smith16-Jun-06 11:29
Josh Smith16-Jun-06 11:29 
GeneralRe: change the name font when enter tab control Pin
donkaiser16-Jun-06 11:44
donkaiser16-Jun-06 11:44 
GeneralRe: change the name font when enter tab control Pin
Josh Smith17-Jun-06 4:17
Josh Smith17-Jun-06 4:17 
GeneralRe: change the name font when enter tab control Pin
donkaiser19-Jun-06 3:46
donkaiser19-Jun-06 3:46 
GeneralRe: change the name font when enter tab control Pin
donkaiser19-Jun-06 4:12
donkaiser19-Jun-06 4:12 
QuestionWindows Service&Installer -A mess Pin
Raghuraman_Ace16-Jun-06 9:20
Raghuraman_Ace16-Jun-06 9:20 
QuestionProgrammatically locate an application in the System Tray Pin
DP IGT16-Jun-06 8:17
DP IGT16-Jun-06 8:17 
AnswerRe: Programmatically locate an application in the System Tray Pin
BoneSoft16-Jun-06 9:51
BoneSoft16-Jun-06 9:51 
GeneralRe: Programmatically locate an application in the System Tray Pin
DP IGT16-Jun-06 10:55
DP IGT16-Jun-06 10:55 
QuestionProgrammatically getting system information using C# Pin
Cadence2.016-Jun-06 8:07
Cadence2.016-Jun-06 8:07 
AnswerRe: Programmatically getting system information using C# Pin
Josh Smith16-Jun-06 8:18
Josh Smith16-Jun-06 8:18 
GeneralRe: Programmatically getting system information using C# Pin
Cadence2.016-Jun-06 9:35
Cadence2.016-Jun-06 9:35 
QuestionComboBox Databinding Pin
Drew McGhie16-Jun-06 7:32
Drew McGhie16-Jun-06 7:32 
QuestionWord interop problem Pin
Amos_Keeto16-Jun-06 7:10
Amos_Keeto16-Jun-06 7:10 
AnswerRe: Word interop problem Pin
Dustin Metzgar16-Jun-06 7:57
Dustin Metzgar16-Jun-06 7:57 
GeneralRe: Word interop problem Pin
Amos_Keeto16-Jun-06 8:02
Amos_Keeto16-Jun-06 8:02 

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.