C
cj
My code below gives me "SQL: Column 'BTN' is not found."
It will work if I use an inner join or just join but those two joins
don't return all the rows. BTN has 5 rows, but arcust01 has only has
matching records for 2 of them. I need the other 3 returned with nulls
in the fields from arcust01.
How can I do this?
Imports System.Data.OleDb
Public Class Form1
Dim myOleDbConnection As OleDbConnection
Dim myOleDbCommand As OleDbCommand
Dim myOleDbDataAdapter As OleDbDataAdapter
Dim dt As New DataTable
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
myOleDbConnection = New
OleDbConnection("Provider=vfpoledb.1;Data Source=c:\;Collating
Sequence=general")
myOleDbCommand = New OleDbCommand
myOleDbDataAdapter = New OleDbDataAdapter
Dim fields As String = "select btn.btn, arcust01.lastpay,
arcust01.balance "
Dim from As String = "from btn outer join f:\chris\arcust01
arcust01 on btn.btn = arcust01.custno"
myOleDbCommand.CommandText = fields & from
'myOleDbCommand.CommandText = "select btn.btn from btn"
myOleDbCommand.Connection = myOleDbConnection
myOleDbDataAdapter.SelectCommand = myOleDbCommand
myOleDbDataAdapter.Fill(dt)
DataGridView1.DataSource = dt
MessageBox.Show("done!")
End Sub
End Class
It will work if I use an inner join or just join but those two joins
don't return all the rows. BTN has 5 rows, but arcust01 has only has
matching records for 2 of them. I need the other 3 returned with nulls
in the fields from arcust01.
How can I do this?
Imports System.Data.OleDb
Public Class Form1
Dim myOleDbConnection As OleDbConnection
Dim myOleDbCommand As OleDbCommand
Dim myOleDbDataAdapter As OleDbDataAdapter
Dim dt As New DataTable
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
myOleDbConnection = New
OleDbConnection("Provider=vfpoledb.1;Data Source=c:\;Collating
Sequence=general")
myOleDbCommand = New OleDbCommand
myOleDbDataAdapter = New OleDbDataAdapter
Dim fields As String = "select btn.btn, arcust01.lastpay,
arcust01.balance "
Dim from As String = "from btn outer join f:\chris\arcust01
arcust01 on btn.btn = arcust01.custno"
myOleDbCommand.CommandText = fields & from
'myOleDbCommand.CommandText = "select btn.btn from btn"
myOleDbCommand.Connection = myOleDbConnection
myOleDbDataAdapter.SelectCommand = myOleDbCommand
myOleDbDataAdapter.Fill(dt)
DataGridView1.DataSource = dt
MessageBox.Show("done!")
End Sub
End Class