VB.NET里的绝对路径怎么编程相对路径
Dim MyConnectionString As String = " Persist Security Info=false;Initial Catalog=master;server=serverIP;uid=sa;pwd=sa;data source=localhost;"Try
MySQL = "EXEC sp_attach_db @dbname = N'hdc',@filename1 = N'I:\wj\xm\hdc_Data.MDF',@filename2 = N'I:\wj\xm\hdc_Log.LDF'"
MyConnection = New SqlConnection(MyConnectionString)
MyConnection.Open()
MyCommand = New SqlCommand(MySQL, MyConnection)
MyCommand.ExecuteReader()
MsgBox("成功添加")
Catch ex As Exception
MsgBox(ex.Message)
End Try
高手帮帮忙吧~~~~~~ --------------------编程问答-------------------- Application.StartupPath '这是你程序的路径
--------------------编程问答-------------------- My.Application.Info.DirectoryPath --------------------编程问答-------------------- My.Application.Info.DirectoryPath --------------------编程问答-------------------- 麻烦说了详细点行吗?我是个新手,谢谢高手了。 --------------------编程问答-------------------- string connstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath+"/data.mdb";
这样写是对的,这是ACCESS的,SQL的一样,你自己改一下把 --------------------编程问答-------------------- connstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath&"/data.mdb"
不好意思,刚才没注意给你写了个C#的,现在改成VB的
--------------------编程问答-------------------- Application.StartupPath '这是你程序的路径 =My.Application.Info.DirectoryPath
补充:.NET技术 , VB.NET