Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting to an Access Database

Status
Not open for further replies.

CompCop911

Programmer
Jun 9, 2004
33
CA
Hi, I am trying to connect to an Access database and retrieve records. I got it working for a LOCAL DB, but the actual DB is on my web server and when I put the Data Source as " etc" then it says invalid file name or something like that...

How do you connect to a REMOTE Access DB?
 
Those are for local dbs, I need to connect to a REMOTE database on my web-host.

ComputerCop911
ASP and HTML Programmer
Learning VB.NET and ASP.NET
Can also help with hardware probs
 
Have you tried anything remotely like this?
Code:
oConn.Open "Provider=MS Remote;" & _
           "Remote Server=[URL unfurl="true"]http://myServerName;"[/URL] & _ 
           "Remote Provider=MSDASQL;" & _
           "DSN=AdvWorks;" & _
           "Uid=myUsername;" & _
           "Pwd=myPassword"


__________________________________________
Try forum1391 for lively discussions
 
I just tried that, and when I run the program, I get the following error:

"The specified cast is not valid."

************* Exception Text **************
System.InvalidCastException: Specified cast is not valid.
at System.Data.OleDb.OleDbException..ctor(IErrorInfo errorInfo, Int32 errorCode, Exception inner)
at System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hResult, OleDbConnection connection, Object src)
at System.Data.OleDb.OleDbDataReader.ProcessResults(Int32 hr)
at System.Data.OleDb.OleDbDataReader.BuildSchemaTableInfo(Object handle, Boolean filterITypeInfo, Boolean filterChapters)
at System.Data.OleDb.OleDbDataReader.BuildSchemaTableRowset(Object handle)
at System.Data.OleDb.OleDbDataReader.GenerateSchemaTable(OleDbDataReader dataReader, Object handle, CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.CommandBuilder.BuildCache(Boolean closeConnection)
at System.Data.OleDb.OleDbCommandBuilder.GetInsertCommand()
at ADODataAdapterTestVB.Form1.btnOpen_Click(Object sender, EventArgs e) in C:\Documents and Settings\Sandeep Nathwani\My Documents\SharpDevelop Projects\ADODataAdapterTestVB\Form1.vb:line 123
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

ComputerCop911
ASP and HTML Programmer
Learning VB.NET and ASP.NET
Can also help with hardware probs
 
Anyone?

ComputerCop911
ASP and HTML Programmer
Learning VB.NET and ASP.NET
Can also help with hardware probs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top