Invalid cast on SQL to other server

J

John Howard

Using the connection string:

..ConnectionString = "Provider=MS Remote;" & _

"Remote Server=http://scfmzcp1;" & _

"Remote Provider=Microsoft.Jet.OLEDB.4.0;" & _

"Data Source=C:\PDB\Development\PDB.mdb, admin, "

I get the imvalid cast message.



Do I have the Remote Server and Data Source parameters correct?

John
 
J

John Howard

I wasn't able to see anything at this URL that seemed to be the answer.

However, I may have another clue. In order to crystalize the problem, I
created the following program:

Imports System.Data.OleDb

Public Class WebForm1

Inherits System.Web.UI.Page

.......

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim intRows As Integer

Dim strSQL As String

Dim ds As New DataSet

Dim cn As New OleDbConnection

cn.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;Data
Source=W:\PDB\Development\PDB.mdb"

cn.Open()

Dim cmd1 As New OleDbCommand

cmd1.Connection = cn

cmd1.CommandText = "SELECT System FROM Reference"

TextBox1.Text = cmd1.ExecuteScalar

End Sub

End Class

Running this program as a Windows application works fine, but running the
SAME code as a Web application returns


Server Error in '/WebTest01' Application.
----------------------------------------------------------------------------
----

'W:\PDB\Development\PDB.mdb' is not a valid path. Make sure that the path
name is spelled correctly and that you are connected to the server on which
the file resides.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException:
'W:\PDB\Development\PDB.mdb' is not a valid path. Make sure that the path
name is spelled correctly and that you are connected to the server on which
the file resides.

Source Error:


Line 30: Dim cn As New OleDbConnection
Line 31: cn.ConnectionString =
"provider=Microsoft.Jet.OLEDB.4.0;Data Source=W:\PDB\Development\PDB.mdb"
Line 32: cn.Open()
Line 33: Dim cmd1 As New OleDbCommand
Line 34: cmd1.Connection = cn


Source File: c:\inetpub\wwwroot\WebTest01\WebForm1.aspx.vb Line: 32

Stack Trace:


[OleDbException (0x80004005): 'W:\PDB\Development\PDB.mdb' is not a valid
path. Make sure that the path name is spelled correctly and that you are
connected to the server on which the file resides.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr)
System.Data.OleDb.OleDbConnection.InitializeProvider()
System.Data.OleDb.OleDbConnection.Open()
WebTest01.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\WebTest01\WebForm1.aspx.vb:32
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()





----------------------------------------------------------------------------
----

Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.573

Does this tell you anything?
 
C

Cor Ligthert

Hi John,

You know that you are in a windows application an other user than with a web
application, that would be my only answer on this.

I do not know the user from the windows application, however from the web it
is of course your asp net user, has that right to access that mdb file?.

Sounds like this should be the problem.

Cor
 
J

John Howard

I'll have to check with the administrator, who is out today.

I will reply again when I find out.

Thanks,

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top