The way I do it is to build a Business Logic Layer that is independent from
the data access layer. (My website for example does not disclose the data
access backend and I rely on using objectDataSource to query my BLL)
The data access layer would be a project that has a reference to the
System.Data.OracleClient namespace. In this project I would add functions to
return data by querying stored procedures (packages), e.g.
Public Function DataSet1(ByVal PARAM1_VALUE As String, ByVal PARAM2_VALUE As
Integer) As DataSet
dim ds = New DataSet
dim cmd = New OracleCommand
cmd.CommandText = "ORACLESCHEMANAME.ORACLETABLE.STOREPROCNAME"
cmd.Parameters.Clear()
cmd.Parameters.Add(New OracleParameter("res_cur",
OracleType.Cursor)).Direction = ParameterDirection.Output
cmd.Parameters.Add(New OracleParameter("PARAM1", OracleType.Char,
2)).Direction = ParameterDirection.Input
cmd.Parameters.Add(New OracleParameter("PARAM2",
OracleType.Number)).Direction = ParameterDirection.Input
cmd.Parameters("PARAM1").Value = PARAM1_VALUE
cmd.Parameters("PARAM2").Value = PARAM2_VALUE
cmd.CommandType = CommandType.StoredProcedure
strCon = AppSettings("DBConnectionString") 'This where you store the
connection string to ORALCE
'e.g. in the web.config you would have
'<configuration>
'<appSettings>
' <add key="DBConnectionString" value="user id=mysuername;data
source=schemaName;password=mypassword;Connection Lifetime=3600" />
'</appSettings>
con = New OracleConnection(strCon)
con.Open()
cmd.Connection = con
da = New OracleDataAdapter(cmd)
da.Fill(ds, "TABLE1")
da.Dispose()
con.Close()
return ds
End If
--
HTH,
Phillip Williams
http://www.societopia.net http://www.webswapp.com
"an*******@gmail.com" wrote:
Hello,
I'm working on an ASP.NET project (VS 2005) utilizing an Oracle
database backend. While I understand that Gridview's are a breeze to
work with using SQL Server (hundreds of sites point that out), I don't
have that option. So I have a couple questions.
1> Does anyone know of some (presumably good) resources of utilizing
ASP.NET against non-SQL Server backends?
2> The issue that I'm having right now is, in my gridview, I have the
Edit, Delete, Select options enabled. When I click Edit, I have to
click it twice. On the first click, it goes through the OnRowEditing
event, just as expected, and on the second click, it goes through the
OnRowEditing... however, the edit boxes aren't visible to me until
after the second Edit click. Same thing with the Cancel (during an
edit). Clicking Cancel once runs it through the events I expect, but
it's not until the second click that the row actually goes back to it's
proper state.
Thanks in advance,
Mike