Wrox Programmer Forums
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 29th, 2003, 01:30 AM
Authorized User
 
Join Date: Jun 2003
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to arshad mahmood
Default SQL statment

Hello Sir
Dear Sir,is it posiable to write SQL statement in the
command button,s click event to update,delete or insert
a new recard to database.if it is posiable for you,
please give me some examples.
Thanks

arshad mahmood
__________________
arshad mahmood
 
Old July 1st, 2003, 02:10 PM
Authorized User
 
Join Date: Jun 2003
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Give this a shot:

Private Sub Command1_Click

Dim cxn as Connection
Dim strSQL As String

With cxn
   .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
          "Absolute Path to your database here"
   .Open
End With
strSQL = "UPDATE myTable " & _
         "SET myTable.Field1=True " & _
         "WHERE myTable.Field1=False;"

cxn.Execute strSQL

cxn.Close
Set cxn = Nothing

End Sub

Kenny Alligood





Similar Threads
Thread Thread Starter Forum Replies Last Post
Hard SQL languge statment Questioin Mangore SQL Language 8 October 27th, 2008 03:01 AM
insert & update statment problem (sql express) abdrabaa C# 2 July 15th, 2007 05:54 AM
Using VB.Net to change the SQL Statment yicksang BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 March 31st, 2006 04:17 AM
if statment knightm28 Classic ASP Databases 2 April 1st, 2005 11:08 AM
SQL Statment btpoole VB Databases Basics 1 February 18th, 2004 01:03 PM





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