Click here to Skip to main content
15,911,890 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralDraw a GPS map Pin
Member 44277182-Mar-08 13:48
Member 44277182-Mar-08 13:48 
GeneralRe: Draw a GPS map Pin
Christian Graus2-Mar-08 22:39
protectorChristian Graus2-Mar-08 22:39 
GeneralRe: Draw a GPS map Pin
Wafdof2-Jul-08 7:15
Wafdof2-Jul-08 7:15 
GeneralRe: Draw a GPS map Pin
nishkarsh_k3-Mar-08 16:36
nishkarsh_k3-Mar-08 16:36 
QuestionValidating User Input Pin
IvanIT2-Mar-08 13:28
IvanIT2-Mar-08 13:28 
GeneralRe: Validating User Input Pin
User 2710092-Mar-08 14:44
User 2710092-Mar-08 14:44 
GeneralRe: Validating User Input Pin
IvanIT3-Mar-08 5:16
IvanIT3-Mar-08 5:16 
Questioncreate MS access DB from VB Pin
mesho2-Mar-08 11:55
mesho2-Mar-08 11:55 
hi
I'm trying to write a code that create DB & tables in MS access using VB, when I excute my code the DB is created but I don't see any table in the DB when I open the access file.
Can any one tell me what's the problem?
This is my code:

Public Function CreateAccessDatabase(ByVal DatabaseFullPath As String) As Boolean
Dim bAns As Boolean
Dim cat As New ADOX.Catalog()
Dim table1 As New ADOX.Table()
Dim cn As ADODB.Connection
cn = New ADODB.Connection

Try
Dim sCreateString As String
sCreateString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DatabaseFullPath
cat.Create(sCreateString)

bAns = True

Catch Excep As System.Runtime.InteropServices.COMException
bAns = False

'Open the connection
cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\testdb.mdb")

'Open the Catalog
cat.ActiveConnection = cn

'Create the table
table1.Name = "Test_Table"

'Create and Append a new field to the "Test_Table"
'Columns Collection
table1.Columns.Append("PrimaryKey_Field", ADOX.DataTypeEnum.adInteger)

'Create and Append a new key. Note that we are merely passing
'the "PimaryKey_Field" column as the source of the primary key.
'Thi snew Key will be Appended to the Keys Collection of
'"Test_Table"
table1.Keys.Append("PrimaryKey", ADOX.KeyTypeEnum.adKeyPrimary, "PrimaryKey_Field")

'Append the newly created table to the Tables Collection
cat.Tables.Append(table1)

' clean up objects
table1 = Nothing
cat = Nothing
cn.Close()
cn = Nothing

Finally

End Try
Return bAns
End Function
GeneralRe: create MS access DB from VB Pin
Dave Kreskowiak3-Mar-08 9:12
mveDave Kreskowiak3-Mar-08 9:12 
Generaldrawicon to listview Pin
benjj2-Mar-08 11:49
benjj2-Mar-08 11:49 
GeneralRe: drawicon to listview Pin
John_Adams3-Mar-08 0:57
John_Adams3-Mar-08 0:57 
GeneralSetup project in VIsaul Studio Pin
highjo2-Mar-08 11:27
highjo2-Mar-08 11:27 
GeneralRe: Setup project in VIsaul Studio Pin
Dave Kreskowiak3-Mar-08 4:09
mveDave Kreskowiak3-Mar-08 4:09 
GeneralRe: Setup project in VIsaul Studio Pin
highjo3-Mar-08 5:54
highjo3-Mar-08 5:54 
QuestionWhy do I sometimes get OleDb.OleDbException or ConstraintException for the same operation? Pin
David Mujica2-Mar-08 9:24
David Mujica2-Mar-08 9:24 
AnswerRe: Why do I sometimes get OleDb.OleDbException or ConstraintException for the same operation? Pin
Dave Kreskowiak3-Mar-08 8:42
mveDave Kreskowiak3-Mar-08 8:42 
NewsNow I only get the ConstraintException error Pin
David Mujica4-Mar-08 3:49
David Mujica4-Mar-08 3:49 
GeneralExtracting Time Only From SQL EXPRESS Time UDT Using VB.NET Pin
AAGTHosting2-Mar-08 9:10
AAGTHosting2-Mar-08 9:10 
GeneralRe: Extracting Time Only From SQL EXPRESS Time UDT Using VB.NET Pin
pmarfleet2-Mar-08 9:22
pmarfleet2-Mar-08 9:22 
QuestionHow to disable Type inference for generic procedures ? Pin
Ky Nam2-Mar-08 6:25
Ky Nam2-Mar-08 6:25 
AnswerRe: How to disable Type inference for generic procedures ? Pin
Dave Kreskowiak3-Mar-08 4:03
mveDave Kreskowiak3-Mar-08 4:03 
GeneralHelp File Pin
parth.p2-Mar-08 1:00
parth.p2-Mar-08 1:00 
GeneralRe: Help File Pin
Smithers-Jones2-Mar-08 1:54
Smithers-Jones2-Mar-08 1:54 
GeneralRe: Help File Pin
parth.p2-Mar-08 3:29
parth.p2-Mar-08 3:29 
GeneralRe: Help File Pin
highjo3-Mar-08 6:24
highjo3-Mar-08 6:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.