System.Runtime.InteropServices.COMException(0x80004005):不是有效的文件名 [英] System.Runtime.InteropServices.COMException (0x80004005): Not a valid file name

查看:864
本文介绍了System.Runtime.InteropServices.COMException(0x80004005):不是有效的文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此错误消息,字符串似乎是正确的,但我不知道该怎么做才能解决这个问题,有人可以帮忙吗?

我将Refrence导入ADO,我正在运行XP。我无法理解这一点。

以下是确切的错误消息:

System.Runtime.InteropServices.COMException(0x80004005):无效的文件名。在WindowsApplication1.Form2.Button3_Click(Object sender,EventArgs e)的ADODB.ConnectionClass.Open(String ConnectionString,String UserID,String Password,Int32 Options)

我的代码信息是:

< font color ="#0000ff"size = 2>

I am recieving this error message, and the string seems to be right, but I am not sure what to do fix this problem, can someone please help? 

I imported Refrence to ADO, and I am running XP. I can't figure this out.

Below is the exact error message:

System.Runtime.InteropServices.COMException (0x80004005): Not a valid file name. at ADODB.ConnectionClass.Open(String ConnectionString, String UserID, String Password, Int32 Options) at WindowsApplication1.Form2.Button3_Click(Object sender, EventArgs e)

My Code Info is:

 

Dim cnt As New ADODB.Connection

Dim cnt As New ADODB.Connection

< font color ="#0000ff"size = 2> Dim rst As New ADODB.Recordset

Dim rst As New ADODB.Recordset

Dim conStr As String

Dim conStr As String

 

conStr = " Provider = Microsoft.ACE .OLEDB.12.0;数据源= | DataDirectory | \ store.accdb;"

conStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\store.accdb;"

 

Dim sqlStr As 字符串 = " SELECT Transaction.Date,Transaction.Time,Transaction.Type_Of_Sale," & _

Dim sqlStr As String = "SELECT Transaction.Date, Transaction.Time, Transaction.Type_Of_Sale, " & _

" Transaction.Total_Products_Bought,Transaction.Total," &安培; _

"Transaction.Total_Products_Bought, Transaction.Total, " & _

" Transaction.Tax FROM Transaction WHERE Transaction.Date =" & Chr(34)& TextBox1.Text& Chr(34)

"Transaction.Tax FROM Transaction WHERE Transaction.Date=" & Chr(34) & TextBox1.Text & Chr(34)

尝试

Try

 

cnt.Open(conStr)

cnt.Open(conStr)

rst.Open(sqlStr)

rst.Open(sqlStr)

虽然 rst.EOF

Do While Not rst.EOF

一旦我可以连接到数据库文件,我就会把文本放在这里,但我甚至无法做到这一点。 br> rst.MoveNext()

I was going to put text here once I could connect to the database file, but I can't even get that far.
rst.MoveNext()

循环

Loop

 

Catch ex < font color ="#0000ff"size = 2> As 异常

Catch ex As Exception

 

#If DEBUG 然后

#If DEBUG Then

 

'将编译成调试版本。

'Will be compiled into a debug build.

 

WebBrowser1.DocumentText = ex.ToString()

WebBrowser1.DocumentText = ex.ToString()

退出 Sub

Exit Sub

#Ellse

 

'将会是编译成发布版本。

'Will be compiled into a release build.

 

MessageBox.Show("当天没有交易 "

MessageBox.Show("No Transaction was done that day")

 

#End 如果

#End If

 

结束 试试

End Try

 

结束 < font color ="#0000ff"size = 2> Sub

End Sub

 

推荐答案

Hi Shawn

这是一个与GAX / GAT相关的论坛,请尝试在更具体的论坛中发布您的问题,也许在C#论坛中。
您可以查看http://forums.msdn.microsoft.com/en-US/forums/ 这是最适用的论坛。

谢谢
jose。
Hi Shawn

This is a GAX/GAT related forum, please try to post your question in more specific forum, maybe in the C# forum.
You can look at http://forums.msdn.microsoft.com/en-US/forums/ which is the most applicable forum.

thanks
jose.


这篇关于System.Runtime.InteropServices.COMException(0x80004005):不是有效的文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆