vb.net - How to generating a new MS access file programmatically -


i have looked far , wide, in deepest darkest corners of internet, life of me, can not find correct way open new access file , using vb.net write data in database..

the keywords here new database, don't want open existing file.

is possible?

thanks in advance!

i have found way, co-worker of mine

neither ado.net nor activex data object (ado) provides means create microsoft access database. however, can create access databases using microsoft jet ole db provider , microsoft ado ext. 2.7 ddl , security (adox) com interop layer. so, select references project menu, choose com tab, , add reference microsoft ado ext. 2.7 ddl , security; can use function.

when have done this, use following snippet create database


public class form1      private sub btnload_click(byval sender system.object, _                               byval e system.eventargs) _                               handles btnload.click          createaccessdatabase("c:\test\testdb.mdb")         msgbox("database created")     end sub 

    public function createaccessdatabase( byval databasefullpath string) boolean         dim bans boolean         dim cat new adox.catalog()         try              dim screatestring string             screatestring =_                             "provider=microsoft.jet.oledb.4.0;data source=" & _                            databasefullpath             cat.create(screatestring)               bans = true          catch excep system.runtime.interopservices.comexception              bans = false                      cat = nothing         end try         return bans     end function end class 


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -