Visual Basic 5.0 SQLgreenspun.com : LUSENET : SQL Server Database Administration : One Thread
I am a lowly Visual Foxpro programmer. I love this canned, easy to use programming software. (I really impress my boss!) However, as I learn VB, SQL statements are driving me nuts. What's the deal with SQL and VB? I can't get any SQL to run in VB.
I would love a single, simple example of how to use SQL in a command button on a form.
More power to you. and..Thanks!
(by the way..because your site has so impressed me...what are your thoughts on the most lucrative and 'in demand' VB programming?)
-- Anonymous, August 31, 1998
Sorry for the delay in answering. Your question slipped through the cracks.
Anyway, here is a code sample that may help. You will also have to create the DSN: Dim ws as Workspace Dim db as Database dim strSQL as String
Set ws = CreateWorkspace("ODBCWorkspace", "", "", dbUseODBC)
Set db = ws.OpenDatabase("inandout", dbDriverNoPrompt, False, _ "ODBC;DATABASE=inandout;UID=sa;PWD=;DSN=cdf")
strSQL = "INSERT INTO MyTableName VALUES _ ('value1','value2','value3')" db.Execute strSQL
Your "by the way" question is also interesting. One way to check what is in demand on the job marker is to go to OCC (Online Career Center) and count how many jobs are available that mention certain keywords. For instance, on 11/30/1998, if I go to http://seattle.wa.occ.com and click the "Browse all Seattle Jobs" button, I am told that there are 1510 jobs. If I search for vb or 'visual basic', I am told there are 224 jobs. c++ has 353 jobs. sql has 318 jobs. java has 102. HTML has 136. You can do your own search on your own city and your own terms and find out what is hot and what is hype.
Again, sorry for the delay,
-- Anonymous, November 30, 1998