Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How I can make a login screen using ASP.NET & Oracle DB 10g R2 by ODAC11g

436595Jan 14 2009
People,

I am now using Visual Studio 2005 , and try to make a system by ASP.NET as interface and the database is Oracle DB 10g R2 & ODAC 11g.

when i start to develop the system most of people tell me better to use ODP.NET , but the problem is :

How create a login screen ?

i create a table in the database as :

create table users
(
username number primary key,
password varchar2(500
);

then I create a web page that has two field ( u_username , u_Password ) and one button called : OK_button
, the i write the code below inside the event of ( Button_Clicked ) as:


Imports Oracle.DataAccess.Client
Imports Oracle.DataAccess.Types
*Partial Class _Default*
Inherits System.Web.UI.Page


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As String = "DATA SOURCE=OPST;PASSWORD=bs;PERSIST SECURITY INFO=True;USER ID=BS"
Dim con As New OracleConnection(s)
Dim cmd As New OracleCommand
cmd.CommandType = Data.CommandType.StoredProcedure
cmd.CommandText = "Parameter"
cmd.Parameters.Add("@username", OracleDbType.Int32, 8).Value = Me.u_username.Text
cmd.Parameters.Add("@password", OracleDbType.Char, 50).Value = Me.u_password.Text
Dim p As OracleParameter = cmd.Parameters.Add("return_value", OracleDbType.Int32)
p.Direction = Data.ParameterDirection.ReturnValue
cmd.Connection = con
con.Open()
Dim x As Integer = cmd.ExecuteScalar()
If x <> 0 Then My.Response.Redirect("~/Default2.aspx")
con.Close()

End Sub
End Class


Then when i run the web page it is show me this message with Line 9 error :

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30560: 'OracleConnection' is ambiguous in the namespace 'Oracle.DataAccess.Client'.

Source Error:



Line 7: Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Line 8: Dim s As String = "DATA SOURCE=OPST;PASSWORD=bs;PERSIST SECURITY INFO=True;USERID=BS"
Line 9: Dim con As New OracleConnection(s)
Line 10: Dim cmd As New OracleCommand
Line 11: cmd.CommandType = Data.CommandType.StoredProcedure


Source File: C:\Documents and Settings\ITU_Admin\My Documents\Visual Studio 2005\WebSites\Business_Support\Default.aspx.vb Line: 9



Show Detailed Compiler Output:




Can Any one help me ? Please Plz
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 11 2009
Added on Jan 14 2009
0 comments
1,553 views