how to store data into sql server using VB 6

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2007
Posts: 17
Reputation: bungek84 is an unknown quantity at this point 
Solved Threads: 0
bungek84 bungek84 is offline Offline
Newbie Poster

how to store data into sql server using VB 6

 
0
  #1
Aug 1st, 2008
hi guys..
i got one big problem rite now..currently i'm handling new project using VB 6 and MS SQL Server as host server. Rite now i'm stuck at store/save data into the server. Previously, i'm using C#.Net and it success but then i'm not sure whether the code from .Net can be used in VB 6 or not..the system can't run..hope someones can teach me..

Regards,
ct

Here my example code:

Private Sub SaveData()
'conn = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;password ='999999';Data Source=(local);Initial Catalog =TGB"
Dim cmd As New Command
Dim facID As New ADODB.Parameter
Dim lineno As New ADODB.Parameter
Dim timedate As New ADODB.Parameter
Dim blockno As New ADODB.Parameter
Dim glovetype As New ADODB.Parameter
Dim Size As New ADODB.Parameter

cmd = " INSERT INTO DMF_ERP_TumTag(FactoryID, TTLineNo, DateTime, " _
& "BlockNo, GloveType, TTSize)" _
& " VALUES ('" & cboFacId.Text & ", " & ComboBox1.Text & "," _
& " #" & txtDateTime.Text & "#, " & Text2.Text & ", " & cboGloveType & ", " & cboSize.Text & " ')"

rs.Open strsql, Conn2, adOpenStatic, adLockReadOnly

facID.Value = cboFacId.Text
cmd.Parameters.Append facID
lineno.Value = ComboBox1.Text
cmd.Parameters.Append lineno
timedate.Value = txtDateTime.Text
cmd.Parameters.Append timedate
blockno.Value = Text2.Text
cmd.Parameters.Append blockno
Set rs = sqlCommand.Execute
Conn2.Close
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC