Hello people,
I have made a code that processing a query through a sql database, and you can see the result in a datagridview.
this is my code:
I get this result:Code:Dim SR As String = "Language(.*)\p(.*)\pContext Match(.*)\p(.*)\p(.*)\p" Dim RS As String = "Language\1\r\nContext Match\3" Dim da As SqlDataAdapter Dim SQLStr As String Dim cnn As SqlConnection Dim myDatatable As New DataTable() DataGridView1.DataSource = Nothing cnn = New SqlConnection(connectionString) cnn.Open() 'Query för alla kolumner SQLStr = "SELECT DISTINCT '(' + CAST (tt.offertnr as varchar(10))+ ')'+ CAST (tt.OrderNr AS varchar(10)) + ' – ' + PostIt.Text AS 'Context Matches' " & _ "FROM [Teknotrans_dev].dbo.OpusOrder as tt INNER JOIN" & _ "[mYDB].dbo.CompanyMain as c On tt.bolagsnr = c.id INNER JOIN" & _ "[mYDB].dbo.OpusOrderrow as ord On ord.ordernr = tt.ordernr INNER JOIN" & _ "[mYDB].dbo.PostIt as PostIt On PostIt.ordernr = tt.ordernr INNER JOIN" & _ "[mYDB].dbo.OrderVolvoLanguageName as snSrc ON ord.kallspraknr = snSrc.spraknr INNER JOIN" & _ "[mYDB].dbo.OrderVolvoLanguageName as snTrg ON ord.malspraknr = snTrg.spraknr" da = New SqlDataAdapter(SQLStr, TTCon) Dim mydataset As New DataSet da.Fill(mydataset) Dim mylist As New List(Of String) For Each mydatarow In mydataset.Tables(0).Rows If mydatarow.item(0).ToString().Contains("Language: ") Then mylist.Add(mydatarow.item(0).ToString()) End If Next DataGridView2.DataSource = mylist
As you see in my result I just get length.
but If I use this code below I can alert the actually content I want to show for each rows:
(see code below)
I get this resultCode:For Each item In mylist MsgBox(item.ToString()) Next
Why is not the content viewed in my rows?
Could someone help me?
Thank you in advance




Reply With Quote
