with code ? How , where can I start off ?
Printable View
with code ? How , where can I start off ?
How about start by compacting those 3 posts into 1.
Each one is separate question with different solutions ? right ?Quote:
Originally posted by Cander
How about start by compacting those 3 posts into 1.
I did some search , I found out that I should use old ADO methods , Does this mean ADO.NET Can't do this ? Correct me if I'm wrong ! I hope so .:(
A sql Or Access database?
I can ask someone
MS Access Database . Thank you cgj :D :D
Do you know the structure of the database? or do you want to create it at runtime through user input?
I don't know the structure . All what I want to do is create it at runtime . Can you help plz?:DQuote:
Originally posted by Memnoch1207
Do you know the structure of the database? or do you want to create it at runtime through user input?
This might help you out.
Memnoch1207 thanks
It's For Sql
It's for SQL unfortunately . :( . I should have said I'm working on MS Access . Thanks Memnoch1207 .:)
try this link pirate :) it's very good
ADO in .net explained the easy way
Hi dynamic_sysop Thanks for the post
That article has nothing about creating a database from code,
dynamic_sysop , I appreciate your help but I really need to create new database file . I know how to do different stuff on the data though . I'm frustrated by now .:( :(
I don't think there is a .NET way to create a new Access database. If you are in a real jam you can use the ADOX COM (VB6) way or I had a workaround for ya. You could keep a completely blank Access database in a .NET resource file and extract it out at runtime to create a new database. I think you can use the SchemaTable setup that I showed you about before to add tables and fields once you get the database itself.
I'm not sure if you can add fields and tables via the Schema or not just a guess. I think you can for xml files but I'm not sure on Access databases.
Yeah , I thought that too . ADO.NET still leak this . Damn MS . They can't do everything perfect . :rolleyes: . Edneeis you are really brilliant . I liked your idea . Definitely I'll try it out *but* before that what do you think of this solution :
I'll use ADOX and write that code in VB6 . Make a dll or just convert the module file to .NET . I know this is interoper. but eh . I donno . :(
and btw I can't remember SchemaTable thingy ...lol . If you can help me with the other two posts , I'll be grateful . Damn , it doesn't seem my day . Hell of bugs , errors , problems ...lol .
Using ADOX is definately easier and since .NET requires MDAC 2.7 it shouldn't be a problem you'll just need to add a reference to it in your .NET project (which creates the .NET wrapper for it). Here is how to do it with ADOX.
http://www.freevbcode.com/ShowCode.Asp?ID=3315
You don't even need to make a VB6 dll or use VB6 code. The .NET version using ADOX shouldn't be much different.
:eek: only two lines . :D:D . I hope they work for me . I'm dead tired now . I need to sleep . I'll look into it .
Thanks Edy .
Good night or whatever ....lol :D
Yeah only 2 lines. Although I changed the link so check it again tomorrow. Good luck and good night.
You are VB.NET Forum leader .:)
And although i have not seen (and may never see) him in person, I really beleive he is a real nice man. I have learned a lot from him. Thanks Edneeis.Quote:
You are VB.NET Forum leader .
Thanks Edneeis
Pirate I am still waiting for a reply form a .net expert,
I will post ASAP
Thank you cgi . That's very kind of you . I can wait :)Quote:
Originally posted by cgj
Pirate I am still waiting for a reply form a .net expert,
I will post ASAP
Microsoft article about ADOX and .net
http://support.microsoft.com/default...en-us%3B317867
And that's what I'm using right now . It's ADOX-based . Still unmanaged code . What I really wanted is pure ADO.NET way but that's apparently for SQL Server db . Thanks anyways for the link . :)
Tried this example and works great, but how can I add more tables in it?
I tried This, but doesn't work for some reason.
ADOXtable.Name = "Addressbook",
ADOXtable.Columns.Append("Firstname1", ADOX.DataTypeEnum.adVarWChar, 50)
ADOXtable.Columns.Append("Middlename1", ADOX.DataTypeEnum.adVarWChar, 50)
ADOXtable.Columns.Append("Lastname1",
ADOXcatalog.Tables.Append(ADOXtable)
ADOXtable.Name = "Addressbook2",
ADOXtable.Columns.Append("Firstname2", ADOX.DataTypeEnum.adVarWChar, 50)
ADOXtable.Columns.Append("Middlename2", ADOX.DataTypeEnum.adVarWChar, 50)
ADOXtable.Columns.Append("Lastname2",
ADOXcatalog.Tables.Append(ADOXtable)
ADOXtable = Nothing
ADOXindex = Nothing
ADOXcatalog = Nothing
Thanks for your help...
You should probably start a new thread, I think a lot of people aren't going to look here since it is marked as resolved. BUT it might have something to do with reuseing the same instance of the Table. Try initializing it to a New table before adding the second one.
VB Code:
ADOXtable.Name = "Addressbook", ADOXtable.Columns.Append("Firstname1", ADOX.DataTypeEnum.adVarWChar, 50) ADOXtable.Columns.Append("Middlename1", ADOX.DataTypeEnum.adVarWChar, 50) ADOXtable.Columns.Append("Lastname1", ADOXcatalog.Tables.Append(ADOXtable) ADOXTable=New ADOX.ADOXTable ADOXtable.Name = "Addressbook2", ADOXtable.Columns.Append("Firstname2", ADOX.DataTypeEnum.adVarWChar, 50) ADOXtable.Columns.Append("Middlename2", ADOX.DataTypeEnum.adVarWChar, 50) ADOXtable.Columns.Append("Lastname2", ADOXcatalog.Tables.Append(ADOXtable)
I didn't test this code or anything and I'm not sure what the actual object name is for the ADOX Table but you should get the idea.
Here's the solution though .
http://www.vbforums.com/showthread.p...43#post1479343