|
-
Feb 16th, 2007, 06:46 PM
#1
Thread Starter
Hyperactive Member
Microsoft Access
I'm using Access 2003. How do I get my data grid in my software to display the information contained with an Access file located on my desktop?
If anyone has the code string, it would be appreciated...
-
Feb 16th, 2007, 07:04 PM
#2
Hyperactive Member
Re: Microsoft Access
I'm not familiar with Access. For SQL Server we import System.Data.SQLClient. For Oracle we import Oracle.DataAccess.Client so I imagine Access does something similar although somebody in another thread said 'just add it to your project'. Build a connection string & create a connection object (SQLConnection for SQL Server) using that string. Finally, open the connection object. Now, you can read the data using either a DataAdapter or a DataReader.
I'm also not very familiar with DataGridView but I imagine they have a datasource object. I doubt if you can set it directly to the database, usually that requires setting it to either a table or the output of a SQL statement (which is treated like a table if you use a DataAdapter to put it in a DataSet).
Hopefully this gives you enough 'clues' that you can find what you need in Help. Sorry I can't be more specific but like I said, I don't use either Access or DataGrids.
-
Feb 16th, 2007, 07:15 PM
#3
Frenzied Member
-
Feb 16th, 2007, 08:59 PM
#4
Re: Microsoft Access
I've already provided you some links to ADO.NET tutorials in a previous thread, specifically those in my signature. The Start VB.NET site has a section dedicated to Access event. The information you need is already at your disposal.
-
Feb 16th, 2007, 09:05 PM
#5
Thread Starter
Hyperactive Member
Re: Microsoft Access
I've been reading that stuff, but a lot of it seems a little complicated...
-
Feb 16th, 2007, 09:30 PM
#6
Thread Starter
Hyperactive Member
Re: Microsoft Access
From what I read, here is the code I have to make the database load from the file on my desktop, but I keep getting an error on the "import" tag... it's a syntax error... anyone know how to fix that?
Code:
'Imports OleDb namespace
Imports System.Data.OleDb()
Dim I As Integer = 0
Dim dteAboutVBDate(10000) As Date
Dim strAboutVBDesc(10000) As String
Dim blnAboutVB6(10000) As Boolean
Dim blnAboutVBNet(10000) As Boolean
Dim urlAboutVBURL(10000) As String
Dim strAboutVBConn As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;" _
& "User ID=Admin;" _
& "Data Source=C:\Documents and Settings\conflix\Desktop\db2.ldb"
-
Feb 16th, 2007, 09:41 PM
#7
Re: Microsoft Access
Namespaces aren't followed by parentheses, nor does that Start VB.NET page suggest that they are. You may also like to check out TechGnome's ADO.NET tutorial from my signature. It is written for SQL Server but all you have to do is change SqlClient to OleDb and everything else is the same. Also see www.connectionstrings.com for the appropriate connection string format if you're unsure.
Also, why do you have five arrays with 10001 elements each?
-
Feb 16th, 2007, 09:51 PM
#8
Thread Starter
Hyperactive Member
Re: Microsoft Access
i got it from one of your links... i'm trying to understand what i need and don't need... i'm looking at what you just gave me...
i'm looking at the strings, but everytime i try one, it tells me the first word is an error... how do i fix that?
-
Feb 16th, 2007, 10:08 PM
#9
Re: Microsoft Access
I can't tell you how to fix an error if I don't know what it is. I don't know what strings you mean, what word you mean or what the actual error message is. Whenever you get an error show what you did and what the error is. Otherwise we're just guessing.
-
Feb 16th, 2007, 10:23 PM
#10
Thread Starter
Hyperactive Member
Re: Microsoft Access
just the word "driver" shows as a syntax error
Code:
Driver={SQL Server};Server=p3swhsql-v01.shr.phx3.secureserver.net;Database=DB_1002583;Uid=stepyourgameup;Pwd=millions;
If I try this one, the word "Provider" gives me a syntax error
Code:
Provider=sqloledb;Data Source=p3swhsql-v01.shr.phx3.secureserver.net;Initial Catalog=DB_1002583;User Id=stepyourgameup;Password=millions
I've tried replacing the source with my local machine. The database source you see is the one I did on godaddy.
-
Feb 16th, 2007, 10:41 PM
#11
Re: Microsoft Access
The first one is for an ODBC connection to SQL Server, not an OLEDB connection to Access. The second is for an OLEDB connection but to SQL Server, not Access.
Go to www.connectionstrings.com, click on the Access link and get the format for an OleDbConnection. Having said that, you've already got one in you post above because that Start VB.NET example was using an OleDbConnection.
-
Feb 16th, 2007, 11:18 PM
#12
Thread Starter
Hyperactive Member
Re: Microsoft Access
i have SQL server through godaddy. i thought i would try that, but it didn't work...
i've been reading the database info all day, so far, no progress, but i'm going to keep reading unless anyone can tell me what i'm doing wrong or what i'm missing...
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
|