First time poster, go easy please.
I'm new to using access databases in VB.NET. I'm using VS 08 express.
I have 2 databases that are provided to me by 2 different sources, i'm trying to make an interface that allows viewing of data from both at the same time, as well as comparisons of data.
I've been playing with accessing the data, and have been somewhat successful.
I'm using a function that takes a few variables..
-name of the table from which i want to pull the data
-name of the field that i want data from
-name of the field that i'm using as the index
-entry that i'm looking for in the index field
example:
table2
colmn 1 | colmn 2 | colmn 3
data 1.1 data 1.2 data 1.3
data 2.1 data 2.2 data 2.3
calling myfunction(table2 as strTableToSearch, colmn 1 as strIndexColmn, data 2.1 as strEntryToLookfor, colmn 3 as strWantedReturnField)
would return "data 2.3"
I have the function in a class so i can create an instance for each database.
In the function i'm using the .ExecuteScalar method following a OleDbCommand
I'm setting the OleDbcommand.text with the varriables passed to my function...
This all seemed to be working perfectly until I found that the database i wasn't testing with had spaces in the Table name, AND some of the colmn names.
I've done some playing with my oledbcommand.text adding and every combination i can think of [ ], ' ', {}, ` `, .. none of them seem to allow for the spaces in the Table name and the First colmn name of my oledbcommand.text string.
here's an example of my string with out the varriables
.CommandText = "Select [Call Letters],[Market] FROM [Computer] WHERE [Market] = 'DON-2007'"
this works sometimes but not always, errors occuring mainly when the table name (in that example "Computer") has spaces in it.
Any help?
If i need to provide any other information please let me know.
PS i've done quite a bit of google searching, Maybe someone else has some better keywords to search for to point me in the right direction. Maybe someone even has a class already written to handle this.
Thanks in advance - Tom
I'm new to using access databases in VB.NET. I'm using VS 08 express.
I have 2 databases that are provided to me by 2 different sources, i'm trying to make an interface that allows viewing of data from both at the same time, as well as comparisons of data.
I've been playing with accessing the data, and have been somewhat successful.
I'm using a function that takes a few variables..
-name of the table from which i want to pull the data
-name of the field that i want data from
-name of the field that i'm using as the index
-entry that i'm looking for in the index field
example:
table2
colmn 1 | colmn 2 | colmn 3
data 1.1 data 1.2 data 1.3
data 2.1 data 2.2 data 2.3
calling myfunction(table2 as strTableToSearch, colmn 1 as strIndexColmn, data 2.1 as strEntryToLookfor, colmn 3 as strWantedReturnField)
would return "data 2.3"
I have the function in a class so i can create an instance for each database.
In the function i'm using the .ExecuteScalar method following a OleDbCommand
I'm setting the OleDbcommand.text with the varriables passed to my function...
This all seemed to be working perfectly until I found that the database i wasn't testing with had spaces in the Table name, AND some of the colmn names.
I've done some playing with my oledbcommand.text adding and every combination i can think of [ ], ' ', {}, ` `, .. none of them seem to allow for the spaces in the Table name and the First colmn name of my oledbcommand.text string.
here's an example of my string with out the varriables
.CommandText = "Select [Call Letters],[Market] FROM [Computer] WHERE [Market] = 'DON-2007'"
this works sometimes but not always, errors occuring mainly when the table name (in that example "Computer") has spaces in it.
Any help?
If i need to provide any other information please let me know.
PS i've done quite a bit of google searching, Maybe someone else has some better keywords to search for to point me in the right direction. Maybe someone even has a class already written to handle this.
Thanks in advance - Tom