Click here to Skip to main content
15,891,938 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi to all.

I need some help........
i want to copy my 3 sql files in this 3 works field.

Thanks........

VB
Private Sub Find_Machine_Customer()
    Dim Work_mst_roller_code As String = ""
    Dim con As OleDbConnection = New OleDbConnection(Main_Form.ConString)
    Dim cmd As OleDbCommand = New OleDbCommand("SELECT mst_roller_last_location, mst_roller_last_supp, mst_roller_type_pipe_id FROM Master_Roller WHERE Master_Roller.mst_roller_id = " & Parm_Roller_Roller, con)
    con.Open()
    work1
    work2
    work3
    con.Close()
    con = Nothing
End Sub
Posted
Comments
Richard C Bishop 27-Dec-12 16:58pm    
That is not a question. Elaborate and specify a probelm you are having.
Sergey Alexandrovich Kryukov 27-Dec-12 17:23pm    
I would also advise to compose a more specific title for your questions. You need right people to pay attention for your post, not the opposite. :-)
—SA
Aarti Meswania 27-Dec-12 23:43pm    
do you mean by select record from sql and write in Excel worksheet?

1 solution

try this

VB
Private Sub Find_Machine_Customer()
        Dim Work_mst_roller_code As String = ""
        Dim con As OleDbConnection = New OleDbConnection(Main_Form.ConString)
	Dim dtbl_main As DataTable = New DataTable
        Dim cmd As OleDbCommand = New OleDbCommand("SELECT mst_roller_last_location, mst_roller_last_supp, mst_roller_type_pipe_id FROM Master_Roller WHERE Master_Roller.mst_roller_id = " & Parm_Roller_Roller, con)
        con.Open()
	Dim adapter1 As OleDbDataAdapter = New OleDbDataAdapter(cmd)
	adapter1.Fill(dtbl_main)
	
        work1 =  dtbl_main.Rows(0)(1).ToString
        work2 = dtbl_main.Rows(0)(2).ToString
        work3  = dtbl_main.Rows(0)(3).ToString
        con.Close()
        con = Nothing
    End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900