ThePentiumGuy Posted March 20, 2004 Posted March 20, 2004 hey, when i open up a connection, i need to provide a string [size=2][color=#0000ff]Dim[/color][/size][size=2] StrConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\" & Filename & ".dtq" 'i created a 'field, and it saved as a .dtq [/size][size=2][color=#0000ff]Dim[/color][/size][size=2] Conn [/size][size=2][color=#0000ff]As[/color][/size][size=2] OleDbConnection [/size][size=2][color=#0000ff]Dim[/color][/size][size=2] Cmd [/size][size=2][color=#0000ff]As[/color][/size][size=2] OleDbCommand [/size][size=2][color=#0000ff]Dim[/color][/size][size=2] DataReader [/size][size=2][color=#0000ff]As[/color][/size][size=2] OleDbDataReader Conn = [/size][size=2][color=#0000ff]New[/color][/size][size=2] OleDbConnection(StrConnection) ' right here is where my error is[/size] but im not too sure weather the provider is "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" what would it be in MSDE's case? ( i got this source from my book, which i think used Acess to create their database (*.mdb files) anyone know what im supposed to do? thanks, pent Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
Moderators Robby Posted March 20, 2004 Moderators Posted March 20, 2004 Change all your OleDb to SQL (Import System.Data.SqlClient) once you do that you don't need Provider in your connection string Quote Visit...Bassic Software
ThePentiumGuy Posted March 20, 2004 Author Posted March 20, 2004 (edited) oh but where would i specify what file im reading? edit: i tried this: [size=2][color=#0000ff]Dim[/color][/size][size=2] conn [/size][size=2][color=#0000ff]As[/color][/size][size=2] SqlConnection [/size][size=2][color=#0000ff]Dim[/color][/size][size=2] Cmd [/size][size=2][color=#0000ff]As[/color][/size][size=2] SqlCommand [/size][size=2][color=#0000ff]Dim[/color][/size][size=2] DataReader [/size][size=2][color=#0000ff]As[/color][/size][size=2] SqlDataReader conn = [/size][size=2][color=#0000ff]New[/color][/size][size=2] SqlConnection() conn.ConnectionString = Application.StartupPath & "\Size.dtq" conn.Open() 'just to test weather it works, i tried to messagebox the first cell i did: [size=2]MessageBox.Show(DataReader.GetInt32(0))[/size] unfortunately, the error is in conn.ConnectionString = Application.StartupPath & "\Size.dtq" which exists, but it says: An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll Additional information: Expected '=' delimiter while parsing connection value pair. Then i changed the line to: conn.ConnectionString = conn.ConnectionString() = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\Size.dtq" The error here is: An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll Additional information: Unknown connection option in connection string: provider. taking out the "Provider=" still causes an erorr. Finally i tried changing it to conn.ConnectionString() = "Data Source=" & Application.StartupPath & "\Size.dtq" :-) now the error shifts from THIS line to the line after it: Conn.Open() now saying, An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll Additional information: System error. does anyone know what im doing wrong? -Pent [/size] Edited March 20, 2004 by ThePentiumGuy Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
Moderators Robby Posted March 20, 2004 Moderators Posted March 20, 2004 There is no file with SQL Server, have a look at this sample ... http://samples.gotdotnet.com/QuickStart/winforms/default.aspx?url=/quickstart/winforms/doc/DataAccessPlaceHolder.aspx Quote Visit...Bassic Software
ThePentiumGuy Posted March 20, 2004 Author Posted March 20, 2004 wow, that's a great link :-D! so basically, I cant store information in a premade DB, and when i distribute my application it'll (for example) MessageBox some of the contents of the DB? im assuming this becuase you cant open premade DB files in SQL Server. is this true? Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
Moderators Robby Posted March 20, 2004 Moderators Posted March 20, 2004 Err, yeah. Quote Visit...Bassic Software
ThePentiumGuy Posted March 21, 2004 Author Posted March 21, 2004 ohh :( that's the reason i wanted to do DB's in the first place, what type of DB program would i need to create files readable by the OleDB thing?(anything besides Microsoft Access - anything free?) Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.