| | |
how to store data into sql server using VB 6
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2007
Posts: 17
Reputation:
Solved Threads: 0
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
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
![]() |
Similar Threads
- ASP.NET SQL Server Setup Wizard: Failure (ASP.NET)
- SQL Server IMAGE and VB.NET (VB.NET)
- datagrid functionality (VB.NET)
- Working with SQL server's Image data type (ASP.NET)
- How to call a EJB method from Session bean method (Java)
- ASP/ Flash Integration using sql server 2000 (ASP)
- Autonumber in a SQL Server table (MS SQL)
- Exception Data is Null. This method or property cannot be called on Null values. (VB.NET)
- Unable to insert data into SQL Database (ASP)
Other Threads in the VB.NET Forum
- Previous Thread: Pls. help me with my flowchart problem
- Next Thread: Find Com Port
| Thread Tools | Search this Thread |
.net .net2008 2008 access account advanced application array basic beginner browser button buttons center click code combo cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic excel exists fade filter forms generatetags gridview html images input insert intel internet listview map mobile module monitor msaccess net number objects open panel passingparameters pdf picturebox picturebox2 port position print printing problem regex remove right-to-left save search searchvb.net select serial settings shutdown socket sqldatbase sqlserver survey temperature textbox timer timespan transparency txttoxmlconverter update user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year





