October 21, 2015 at 1:14 am
Hello people,
I have made following code:
I want to make a string from "TarLang.AppendText(String.Format("{1}" & vbCrLf, r("Source Language"), r("Target Language")))" and the result I get when I use that.
add the result into a new row in the datagridview
Dim CompanyID As String
CompanyID = OrderNR.SelectedItem.ToString()
SQL.ExecQuery(String.Format("SELECT snSrc.kod as 'Source Language', snTrg.kod as 'Target Language' FROM [teknotrans_dev].dbo.OpusOrderrow as ord INNER JOIN [teknotrans_dev].dbo.OrderVolvoLanguageName as snSrc ON ord.kallspraknr = snSrc.spraknr INNER JOIN [teknotrans_dev].dbo.OrderVolvoLanguageName as snTrg ON ord.malspraknr = snTrg.spraknr WHERE ord.ordernr={0}", CompanyID.Trim()))
TarLang.Clear()
SourLang.Clear()
If SQL.RecordCount > 0 Then
For Each r As DataRow In SQL.SQLDS.Tables(0).Rows
' SourLang.AppendText(String.Format("{0}" & vbCrLf, r("Source Language"), r("Target Language")))
' TarLang.AppendText(String.Format("{1}" & vbCrLf, r("Source Language"), r("Target Language")))
DataGridView1.Rows.Add("fsfd") ' I want to add my result here
Next
'SET THE COMBOBOX TO THE FIRST RECORD
'Company.SelectedIndex = 0
ElseIf SQL.Exception <> "" Then
'REPORT ERRORS
MsgBox(SQL.Exception)
End If
Could someone help me?
Thank you in advance
October 21, 2015 at 8:06 am
This forum is for T-SQL, but what you've posted is clearly not T-SQL. It looks like some variant of C. You'd be better off posting in a forum geared toward the language that you're actually having problems with.
Drew
PS: Yes, I realize that there is T-SQL embedded in your code, but that doesn't make it a T-SQL question.
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 22, 2015 at 1:29 pm
Here's a couple of vb.net examples with bound and unbound datagrids, guessing that its vb.net you're using, you should at least specify the language and whether your datagrid is using datasource binding or not, but like Drew says, not much coding outside of T-SQL going on here.
http://stackoverflow.com/questions/317567/how-to-add-records-in-datagridview-vb-net
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply