If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Help in create table asap

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-12-04, 17:15
meerasan meerasan is offline
Registered User
 
Join Date: Feb 2004
Posts: 4
Help in create table asap

Hi,
I have been working on vb.net project and I am creating a table.
the syntax is like this:

sql = "CREATE TABLE " & s & "(id number(5),val text (9) )"

here i am trying to connect to an access databse and i am storing the name of the table in variable s.
But i get an error which is either field definition error or create table syntax error.Plz help
Reply With Quote
  #2 (permalink)  
Old 02-17-04, 19:12
brianb99999 brianb99999 is offline
Registered User
 
Join Date: Feb 2004
Posts: 37
example (replace source, table name etc):

Dim adoCon As New ADODB.Connection
Dim rsPerson As New ADODB.Recordset
Dim strCon As String

strTableName = "aaaaa"
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\db1.mdb"
adoCon.Open strCon
strSQL = "Create table " & tableName & " (id number(5),val text (9))"
adoCon.Execute(strSQL)


If that doesn't work, try changing the names of the fields to lngID and strVal.
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 On
Pingbacks are On
Refbacks are On