G
Guest
I wonder can someone tell me if it is possible to use 2 databases(.sdf) to return the rows i want for my grid. How does the connections work. As you can see from the code below i use only 1 db connection and default QUANTITY to zero. In fact, QUANTITY must come from an Orders DB under the OrdersDBconnection. How can I do this??
here is my code...
sqlDS = New DataSet
' TODO: Quantity will come from OrdersDB, maybe need to pass twice!
Dim strSQL As String = "Select 0 QUANTITY,ITEMDESC, a.ITEMNMBR ITEMNMBR FROM Products a, CustomerProducts b " & _
" WHERE a.itemnmbr = b.itemnmbr and PRCLEVEL = '" + prclevel + "'" & _
" order by PICKSEQ"
sqlDA = New SqlCeDataAdapter(strSQL, GenericDBconnection)
sqlDA.Fill(sqlDS, "Products")
If VerifyDBConnection(GenericDBconnection) = False Then
Return -1
End If
dgLines.DataSource = sqlDS.Tables("Products")
'sqlDA.Update(sqlDS)
Dim ts As New DataGridTableStyle
ts.MappingName = "Products"
Dim qty As New DataGridTextBoxColumn
qty.MappingName = "QUANTITY"
qty.HeaderText = "Qty"
qty.Width = 50
ts.GridColumnStyles.Add(qty)
Dim item As New DataGridTextBoxColumn
item.MappingName = "ITEMDESC"
item.HeaderText = "Item Description"
item.Width = 150
ts.GridColumnStyles.Add(item)
Dim itemcode As New DataGridTextBoxColumn
itemcode.MappingName = "ITEMNMBR"
itemcode.HeaderText = "Item Code"
itemcode.Width = 1
ts.GridColumnStyles.Add(itemcode)
dgLines.TableStyles.Clear()
dgLines.TableStyles.Add(ts)
GenericDBconnection.Close()
Please help
here is my code...
sqlDS = New DataSet
' TODO: Quantity will come from OrdersDB, maybe need to pass twice!
Dim strSQL As String = "Select 0 QUANTITY,ITEMDESC, a.ITEMNMBR ITEMNMBR FROM Products a, CustomerProducts b " & _
" WHERE a.itemnmbr = b.itemnmbr and PRCLEVEL = '" + prclevel + "'" & _
" order by PICKSEQ"
sqlDA = New SqlCeDataAdapter(strSQL, GenericDBconnection)
sqlDA.Fill(sqlDS, "Products")
If VerifyDBConnection(GenericDBconnection) = False Then
Return -1
End If
dgLines.DataSource = sqlDS.Tables("Products")
'sqlDA.Update(sqlDS)
Dim ts As New DataGridTableStyle
ts.MappingName = "Products"
Dim qty As New DataGridTextBoxColumn
qty.MappingName = "QUANTITY"
qty.HeaderText = "Qty"
qty.Width = 50
ts.GridColumnStyles.Add(qty)
Dim item As New DataGridTextBoxColumn
item.MappingName = "ITEMDESC"
item.HeaderText = "Item Description"
item.Width = 150
ts.GridColumnStyles.Add(item)
Dim itemcode As New DataGridTextBoxColumn
itemcode.MappingName = "ITEMNMBR"
itemcode.HeaderText = "Item Code"
itemcode.Width = 1
ts.GridColumnStyles.Add(itemcode)
dgLines.TableStyles.Clear()
dgLines.TableStyles.Add(ts)
GenericDBconnection.Close()
Please help