Working with Gridview & Oracle

  • Thread starter Thread starter anonymike
  • Start date Start date
A

anonymike

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
 
Hello Mike.
Not sure what is meant by "good resources of utilizing ASP.Net against
non-SQL Server backends....

The access for SQL Server and Oracle are very similary in nature. I would
recommend that you download the Oracle drivers for the .Net platform and use
them, but the Microsoft version works. Once you figure out the connection
information, everything is pretty much the same. So perhaps you could
elaborate a bit more on what you are looking for.
 
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
 
Jim,

Sorry, I should have been more clear on my question, my apologies...
however..

Phillip,

That is exactly the direction I needed! Thank you very much. I was
choking on getting oracle to work as a sqldatasource with the ref
cursors and such, and creating and attaching this object to the
gridview provided all the functionality I needed right off the bat...

Thanks again!

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top