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

New Message on BDOTNET

-----------------------------------------------------------
From: DotNetSaavy (Mr.BabuRaj)
Message 7 in Discussion

Hi, I have included the reference to ODP , but now a new problem has come up.I 
get this message    "ORA-12154: TNS:could not resolve the connect identifier 
specifiedConnection must be open for this operation  <META content="Microsoft 
Visual Studio .NET 7.1" name=GENERATOR> <META content="Visual Basic .NET 7.1" 
name=CODE_LANGUAGE> <META content=JavaScript name=vs_defaultClientScript> <META 
content=http://schemas.microsoft.com/intellisense/ie5 name=vs_targetSchema>"   
The page load event has the following code  
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles MyBase.Load 
'Create the connection object 
Dim con As OracleConnection = New OracleConnection 
Dim oradb As String '= "Data Source=(DESCRIPTION=" _ 
'+ 
"(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=bumblebee1.pcs.mot.com)(PORT=1521)))"
 _ 
'+ "(CONNECT_DATA=(SID=TOOLDB01)));" _ 
'+ "User Id=featuredb;Password=featuredb;" 
oradb = "User Id=featuredb;Password=featuredb;Data Source=TOOLDB01;" 
'Specify the connect string 
con.ConnectionString = oradb '"User Id=featuredb;Password=featuredb;Data 
Source=TOOLDB01;" 
Try 
' Open the connection 
con.Open() 
Response.Write("Connection to Oracle database established successfully !") 
Catch ex As Exception 
Response.Write(ex.Message) 
End Try 
Dim cmdQuery As String = "SELECT empno, ename FROM test_babu" 
' Create the OracleCommand object 
Dim cmd As OracleCommand = New OracleCommand(cmdQuery) 
cmd.Connection = con 
cmd.CommandType = CommandType.Text 
Try 
' Execute command, create OracleDataReader object 
Dim reader As OracleDataReader = cmd.ExecuteReader() 
While (reader.Read()) 
' Output Employee Name and Number 
Console.WriteLine("Employee Number : " & _ 
reader.GetDecimal(0) & _ 
" , " & _ 
"Employee Name : " & _ 
reader.GetString(1)) 
End While 
Catch ex As Exception 
Response.Write(ex.Message) 
Finally 
' Dispose OracleCommand object 
cmd.Dispose() 
' Close and Dispose OracleConnection object 
con.Close() 
con.Dispose() 
End Try 
End Sub  

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

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to