Results 1 to 2 of 2

Thread: select query

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2004
    Posts
    4

    Question select query

    Code:
    Dim sqlstring As String = "SELECT codeprod,descr,TIMH FROM products where codeklados like '" & editklados.Text.ToString & "'"
    Hi there..
    i have the following problem
    i have a master/detail form with orders and products.
    my problem is that i have a combobox at master records that i choose what king of order it is (cars,motorbikes etc) and i want in the comboboxcolumn in the detail datagrid to show me only the products that belongs to the that kind of order. the code that i wrote you works (i think!!!) but as i can see, when i go to the next order i have to requery the selection
    Private Sub orders_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


    Try
    'Attempt to load the dataset.
    Me.LoadDataSet()
    Catch eLoad As System.Exception
    'Add your error handling code here.
    'Display error message, if any.
    System.Windows.Forms.MessageBox.Show(eLoad.Message)
    End Try
    Me.objorderwithdetails_PositionChanged()
    Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=""C:\products\products.mdb"";Jet OLEDBatabase Password=")
    conn.Open()
    Dim ds As New DataSet
    ' select the products based on klados of order
    Dim sqlstring As String = "SELECT codeprod,descr,TIMH FROM products where codeklados like '" & editklados.Text.ToString & "'"
    dataAdapter = New OleDbDataAdapter(sqlstring, conn)
    dataAdapter.Fill(ds, "productlist")

    conn.Close()
    Dim ComboTextCol As New DataGridComboBoxColumn
    With ComboTextCol
    .MappingName = "codeproduct"
    .NullText = 0
    .HeaderText = "ÐåñéãñáöÞ Ðñïúüíôïò"
    .Width = 300
    .ColumnComboBox.BackColor = BackColor.CornflowerBlue()
    .ColumnComboBox.DataSource = ds.Tables("productList").DefaultView
    .ColumnComboBox.DisplayMember = "descr"
    .ColumnComboBox.ValueMember = "codeprod"

    tablestyle.PreferredRowHeight = .ColumnComboBox.Height
    tablestyle.GridColumnStyles.Add(ComboTextCol)
    End With
    End Sub
    Last edited by merovatis; Sep 10th, 2004 at 09:57 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width