Connection string in VB.Net 2003
-
Hi All:confused: I am trying to connect to my database from the front end in VB.NET 2003, the connection strings that i have tried are not working at present. I have VB.NET 2003 program from last year but that was using access as the back end and VB.NET 2003 as the front end. This year i must use oracle as the back end and Vb.Net 2003 as the front end. The connection strings that i have tried do not seem to be correct but i will keep trying it is probably something simple. Yes the database does connect through odbc and the tns file is correct
-
Hi All:confused: I am trying to connect to my database from the front end in VB.NET 2003, the connection strings that i have tried are not working at present. I have VB.NET 2003 program from last year but that was using access as the back end and VB.NET 2003 as the front end. This year i must use oracle as the back end and Vb.Net 2003 as the front end. The connection strings that i have tried do not seem to be correct but i will keep trying it is probably something simple. Yes the database does connect through odbc and the tns file is correct
WIthout seeing any code for the connection string, or an error descriptions, about all anyone can do is point you at ConnectionStrings.com[^].
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
WIthout seeing any code for the connection string, or an error descriptions, about all anyone can do is point you at ConnectionStrings.com[^].
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007the code is
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ctoracleConnection As OleDbConnection Dim ctoracleCommand As OleDbCommand Dim dataRow As OleDbDataReader 'MSDORA is the provider when working with Oracle ctoracleConnection = New OleDbConnection("Provider=MSDAORA.1;User ID=oracle username;password=orac le password; data source=ctoracle") 'opens the connection ctoracleConnection.Open() 'executes the command and assigns it to the connection ctoracleCommand = New OleDbCommand("Select EName from emp", ctoracleConnection) dataRow = ctoracleCommand.ExecuteReader() While dataRow.Read() 'displays data from the table MessageBox.Show("Employee Name" & " " & dataRow(0)) End While dataRow.Close() ctoracleConnection.Close() End Sub End Class _______________________________________________________________________________________________________________________________
-
the code is
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ctoracleConnection As OleDbConnection Dim ctoracleCommand As OleDbCommand Dim dataRow As OleDbDataReader 'MSDORA is the provider when working with Oracle ctoracleConnection = New OleDbConnection("Provider=MSDAORA.1;User ID=oracle username;password=orac le password; data source=ctoracle") 'opens the connection ctoracleConnection.Open() 'executes the command and assigns it to the connection ctoracleCommand = New OleDbCommand("Select EName from emp", ctoracleConnection) dataRow = ctoracleCommand.ExecuteReader() While dataRow.Read() 'displays data from the table MessageBox.Show("Employee Name" & " " & dataRow(0)) End While dataRow.Close() ctoracleConnection.Close() End Sub End Class _______________________________________________________________________________________________________________________________
And the exception message??
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
And the exception message??
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim derbyConnection As OleDbConnection Dim derbyCommand As OleDbCommand Dim dataRow As OleDbDataReader 'MSDORA is the provider when working with Oracle derbyConnection = New OleDbConnection("Provider=MSDAORA.1;User ID=oracle ken;password=tigger; data source=derby.com") 'opens the connection derbyConnection.Open() '''''the code falls over here 'executes the command and assigns it to the connection derbyCommand = New OleDbCommand("Select EName from emp", derbyConnection) dataRow = derbyCommand.ExecuteReader() While dataRow.Read() 'displays data from the table MessageBox.Show("Employee Name" & " " & dataRow(0)) End While dataRow.Close() derbyConnection.Close() End Sub
dave thanks for your help beforehand -
Hi All:confused: I am trying to connect to my database from the front end in VB.NET 2003, the connection strings that i have tried are not working at present. I have VB.NET 2003 program from last year but that was using access as the back end and VB.NET 2003 as the front end. This year i must use oracle as the back end and Vb.Net 2003 as the front end. The connection strings that i have tried do not seem to be correct but i will keep trying it is probably something simple. Yes the database does connect through odbc and the tns file is correct
Try the Oracle Managed Provider for .NET and then use the Connection String this will improve the performance of your application. AliAmjad (MCP)
-
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim derbyConnection As OleDbConnection Dim derbyCommand As OleDbCommand Dim dataRow As OleDbDataReader 'MSDORA is the provider when working with Oracle derbyConnection = New OleDbConnection("Provider=MSDAORA.1;User ID=oracle ken;password=tigger; data source=derby.com") 'opens the connection derbyConnection.Open() '''''the code falls over here 'executes the command and assigns it to the connection derbyCommand = New OleDbCommand("Select EName from emp", derbyConnection) dataRow = derbyCommand.ExecuteReader() While dataRow.Read() 'displays data from the table MessageBox.Show("Employee Name" & " " & dataRow(0)) End While dataRow.Close() derbyConnection.Close() End Sub
dave thanks for your help beforehandThe Provider in the connection string should be just "MSDAORA", drop the ".1" part. I also don't know if putting a period in the database name is legal, nor do I know if putting a space in the User Id, "oracle ken", is legal either. OleDb is a kind of "generic" database interface. Like the other poster said, you'd get much better performance if you used the OPD.Net provider instead. This will, of course, require a rewrite of your code.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
The Provider in the connection string should be just "MSDAORA", drop the ".1" part. I also don't know if putting a period in the database name is legal, nor do I know if putting a space in the User Id, "oracle ken", is legal either. OleDb is a kind of "generic" database interface. Like the other poster said, you'd get much better performance if you used the OPD.Net provider instead. This will, of course, require a rewrite of your code.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007when opening server explorer should the oracle database not be displayed there for me to point to and then test. As the database is not showing there. I tried database connection with my access and it connected successfully but will not connect to the oracle database but it is not displayed in the server explorer.:confused:
-
when opening server explorer should the oracle database not be displayed there for me to point to and then test. As the database is not showing there. I tried database connection with my access and it connected successfully but will not connect to the oracle database but it is not displayed in the server explorer.:confused:
kendo17 wrote:
when opening server explorer should the oracle database not be displayed there for me to point to and then test. As the database is not showing there.
The provider and credentials have to be correct in order for it to connect to the server and get the list of databases. The credentials also have to have permissions in the Oracle server to get that list. I don't know exactly what has to happen on the Oracle server, since I've never used Oracle, nor do I want to.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
kendo17 wrote:
when opening server explorer should the oracle database not be displayed there for me to point to and then test. As the database is not showing there.
The provider and credentials have to be correct in order for it to connect to the server and get the list of databases. The credentials also have to have permissions in the Oracle server to get that list. I don't know exactly what has to happen on the Oracle server, since I've never used Oracle, nor do I want to.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007Oracle & SQL Server Databases are server-based database. They are not Filedatabase like Microsoft Access. So they cannot be open like you open ur access db file. The Oracle Database like SQL Server has an Enterprise Console where you can manage the database t.aransiola
-
Oracle & SQL Server Databases are server-based database. They are not Filedatabase like Microsoft Access. So they cannot be open like you open ur access db file. The Oracle Database like SQL Server has an Enterprise Console where you can manage the database t.aransiola
And you're telling me this why??? I know that, and your answer has nothing to do with the problem.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007