Results 1 to 2 of 2

Thread: Linq to sql help

Threaded View

  1. #2

    Thread Starter
    Junior Member
    Join Date
    Aug 2012
    Posts
    22

    Re: Linq to sql help

    hi guys i've worked through the code and have made a few advancements in that the barcode reader now works and displays the appropriate data in a DGV for the engines but the DGV for the rollin stock is not responding to the barcode reads when i scan a rollin stock barcode. here is the code please help thanks.

    also could someone help me with an idea of how to copy each engine and rolling stock that is scanned into another database so i could have a log with timestamps for each engine and rolling stock that is read... would really appreciate your input thank you in advance.



    Public Class Form1
    Dim s As String = ""
    Dim ctx As New TrainsInfoDataContext


    Private Sub Brcs_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Brcd.KeyDown

    If e.KeyCode = Keys.Return Then
    ProcessTrainIdentifier(Brcd.Text)
    Brcd.Clear()
    End If

    End Sub

    Private Sub ProcessTrainIdentifier(ByVal identifier As String)
    Dim trainInfo = GetTrainInfo(identifier)
    Dim rollinfo = GetRollingStockInfo(identifier)
    'DisplayTrainInfo(trainInfo)
    ' DisplayTrainInfo(trainInfo)
    End Sub


    Private Function GetTrainInfo(ByVal identifier As String) As DataGridView
    ' LINQ To SQL code for engine
    Dim engines = From trn In ctx.Train_Engines
    Where (trn.Serial_Number = identifier)
    Select trn
    Me.Train_EngineBindingSource.DataSource = engines

    End Function

    Private Function GetRollingStockInfo(ByVal identifier As String) As DataGridView
    ' LINQ TO SQL code for rolling stock
    Dim rolling = From rollstck In ctx.Rolling_Stocks
    Where (rollstck.Serial_Number Like identifier)
    Select rollstck
    Me.Rolling_StockBindingSource.DataSource = rolling

    End Function

    End Class
    Last edited by Eng_Mc; Aug 17th, 2012 at 12:55 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