|
-
December 15th, 2002, 12:28 AM
#1
create a new database in VB .NET how?
how do you create a 'new' database with only code in vb .net. I can connect to an existing database and fill a datagrid with its contents. Is it much different than that? I am assuming that after creation is when you would need to add more rows etc.
Or how about this, since the databases are going to be almost virtually the same, is there a way to copy a database with code and than erase not the rows or columns but just the data in the cells themselves?
Last edited by proKrastinate; December 15th, 2002 at 12:32 AM.
-
December 15th, 2002, 10:38 AM
#2
cat = New ADOX.Catalog()
cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & file_name & ";")
'then add your tables as needed
dim tbl as new adox.table
tbl.name ="table_name"
'add your columns as needed
tbl.Columns.Append("column_name", ADODB.DataTypeEnum.adSingle)
'append your catalog (dimmed as cat) to add the new table (dimmed as tbl)
cat.Tables.Append(tbl)
'to add more tables start with "dim tbl as new adox.table"
-
December 15th, 2002, 12:17 PM
#3
thankx for getting me on the right track. I figured out that I needed to add a reference to ADOX and do an imports statement to use your code. Thx again
-
December 15th, 2002, 12:18 PM
#4
one other thing, is it necessary to add this to the end of the oCat.Create
"Jet OLEDB:Engine Type=5")
what does it do?
-
December 15th, 2002, 01:02 PM
#5
I use the code exactly how I showed it to you
-
December 15th, 2002, 11:16 PM
#6
mine wouldn't work that way. It kept saying that adox.catalog was unidentified. but now that i did what was posted above, it seems to work without errors. Haven't tested it yet because my program is still sorting out some stuff before i can check to see whether it creates the db or not.
-
December 16th, 2002, 12:35 AM
#7
did you add adox to your project ?
-
December 16th, 2002, 01:32 AM
#8
do you mean with an imports statement? if so, than yes, but it would only be recognized after i made the reference. before it would only recognize 'Microsoft' 'System' and "i think the name of my proj' to the imports available list that automatically comes up when you type Imports. after addding the reference the ADOX was able to be imported.
Don't know if this matters but im using only vb .net and not the entire visual studio .net.
-
December 16th, 2002, 08:28 AM
#9
Yes in your solutions explorer under references you need to see BOTH adodb and adox
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|