Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 18th, 2013, 08:51 AM
Authorized User
Points: 58, Level: 1
Points: 58, Level: 1 Points: 58, Level: 1 Points: 58, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2011
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default VB 6 Verification, sql insert

Hi

I have this code below:

Set cnHPtest = New ADODB.Connection

With cnHPtest
.Provider = strDBProv
.ConnectionString = strDBString
.CommandTimeout = 1000
.Open
End With

'If txtSalary.Text <> " " And txtmCover <> " " And txtMember.Text <> " " And txtmRate.Text <> " " Then

' MsgBox "Welcome"

tsql = "INSERT INTO Hpacc4(SalaryBill,Rate,Membership,Cover) " & _
"VALUES('" & txtSalary.Text & "','" & txtmCover & "', '" & txtMember.Text & "', '" & txtmRate.Text & "')" & _
"WHERE Scheme = '99993' AND RunMonth = '200604' AND AccCode = '110'"

cnHPtest.Execute (tsql)

'Else
' MsgBox "Enter Values"
'End If

I have of problems with this code.

1. When I run only the inner part of it:
tsql = "INSERT INTO Hpacc4(SalaryBill,Rate,Membership,Cover) " & _
"VALUES('" & txtSalary.Text & "','" & txtmCover & "', '" & txtMember.Text & "', '" & txtmRate.Text & "')" & _
"WHERE Scheme = '99993' AND RunMonth = '200604' AND AccCode = '110'"

I get and error that there is a problem with my where clause, which would mean I didn't write the code correctly, please help.

2. when I un-comment the whole code and try to run, my verification fails, I always get MsgBox "Welcome" even when my text fields are empty
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
vb.net sql autonumber insert GIGAM25 SQL Language 1 July 10th, 2008 01:10 AM
How to insert a Picture in SQL Server using VB 6.0 swadhinm Pro VB Databases 0 September 21st, 2005 06:52 AM
Email verification John K. King Javascript How-To 4 November 24th, 2004 03:59 AM



All times are GMT -4. The time now is 09:29 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.