Click here to Skip to main content
15,887,361 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionWHERE clause of SELECT command Pin
Raabi Anony25-May-16 21:11
Raabi Anony25-May-16 21:11 
AnswerRe: WHERE clause of SELECT command Pin
Raabi Anony25-May-16 21:19
Raabi Anony25-May-16 21:19 
GeneralRe: WHERE clause of SELECT command Pin
Richard Deeming26-May-16 2:03
mveRichard Deeming26-May-16 2:03 
QuestionHow to populate data in combobox gridview in VB.net? Pin
kishore-201625-May-16 11:32
kishore-201625-May-16 11:32 
AnswerRe: How to populate data in combobox gridview in VB.net? Pin
Richard MacCutchan25-May-16 21:03
mveRichard MacCutchan25-May-16 21:03 
GeneralRe: How to populate data in combobox gridview in VB.net? Pin
kishore-20165-Jun-16 10:20
kishore-20165-Jun-16 10:20 
GeneralRe: How to populate data in combobox gridview in VB.net? Pin
Richard MacCutchan5-Jun-16 21:24
mveRichard MacCutchan5-Jun-16 21:24 
QuestionDGV with multiple Tables Pin
Raabi Anony23-May-16 17:41
Raabi Anony23-May-16 17:41 
Hi everybody

I had been trying to code a DatagridView with multiple tables, without much success, until I found the following code; which seems fulfilling my aspirations:

VB
Private Function GetDataSource() As DataTable
    Const sqlSelect As String = "SELECT a.Col1 AS aCol1, a.Col2 AS aCol2, b.Col1 AS bCol1, b.Col2 AS bCol2 " & _
           "FROM dbo.TableA AS a 
			INNER JOIN dbo.TableB AS b ON a.IdCol = b.aIdCol " & _
           "ORDER BY aCol1 ASC, bCol1 ASC"
    Try
        Dim table = New DataTable()
        Using con = New MySqlConnection(My.Settings.MySqlConnectionString)
            con.Open()
            Using da = New MySqlDataAdapter(sqlSelect, con)
                da.Fill(table)
                Return table
            End Using
        End Using
    Catch ex As Exception
        ' log message instead '
        Throw ' don't use throw new Exception or throw ex '
    End Try
End Function
me.DGV1.DataSource = GetDataSource()

But, unfortunately, it gives a couple of the following errors:
MySqlConnection is not defined
MySqlDataAdapter is not defined

Looking forward for some explanation and remedy for these errors.
Please help!
AnswerRe: DGV with multiple Tables Pin
Mycroft Holmes23-May-16 19:53
professionalMycroft Holmes23-May-16 19:53 
SuggestionRe: DGV with multiple Tables Pin
Richard Deeming24-May-16 1:34
mveRichard Deeming24-May-16 1:34 
GeneralRe: DGV with multiple Tables Pin
Mycroft Holmes24-May-16 12:38
professionalMycroft Holmes24-May-16 12:38 
AnswerRe: DGV with multiple Tables Pin
Richard Deeming24-May-16 1:41
mveRichard Deeming24-May-16 1:41 
GeneralRe: DGV with multiple Tables Pin
Raabi Anony24-May-16 16:06
Raabi Anony24-May-16 16:06 
GeneralRe: DGV with multiple Tables Pin
Raabi Anony25-May-16 0:41
Raabi Anony25-May-16 0:41 
GeneralRe: DGV with multiple Tables Pin
Richard Deeming25-May-16 0:55
mveRichard Deeming25-May-16 0:55 
QuestionString or Binary Data Would be Truncated. The Statement has been Terminated Pin
kishore-201622-May-16 7:35
kishore-201622-May-16 7:35 
AnswerRe: String or Binary Data Would be Truncated. The Statement has been Terminated Pin
Sascha Lefèvre22-May-16 12:19
professionalSascha Lefèvre22-May-16 12:19 
QuestionRe: String or Binary Data Would be Truncated. The Statement has been Terminated Pin
Richard MacCutchan22-May-16 21:05
mveRichard MacCutchan22-May-16 21:05 
SuggestionRe: String or Binary Data Would be Truncated. The Statement has been Terminated Pin
Richard Deeming23-May-16 1:52
mveRichard Deeming23-May-16 1:52 
AnswerRe: String or Binary Data Would be Truncated. The Statement has been Terminated Pin
Member 1256155913-Jun-16 5:23
Member 1256155913-Jun-16 5:23 
QuestionHow we can retrieve Gridvalue Pin
MANISHA SONAWANE19-May-16 20:05
MANISHA SONAWANE19-May-16 20:05 
SuggestionRe: How we can retrieve Gridvalue Pin
Richard MacCutchan19-May-16 21:27
mveRichard MacCutchan19-May-16 21:27 
GeneralRe: How we can retrieve Gridvalue Pin
MANISHA SONAWANE19-May-16 22:06
MANISHA SONAWANE19-May-16 22:06 
QuestionRe: How we can retrieve Gridvalue Pin
Richard MacCutchan19-May-16 22:17
mveRichard MacCutchan19-May-16 22:17 
AnswerRe: How we can retrieve Gridvalue Pin
MANISHA SONAWANE19-May-16 23:02
MANISHA SONAWANE19-May-16 23: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.