Working with Gridview & Oracle

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
 
G

Guest

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.
 
G

Guest

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
 
A

anonymike

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
 
Joined
Jul 20, 2006
Messages
1
Reaction score
0
I am having the same issue - I have a custom Edit Linkbutton. The first time I click it, it fires the RowCommand event which is SUPPOSED to set the EditIndex and put the row in edit mode. It does not. However, the second time I click Edit, it bypasses the RowCommand event entirely but does put the row in edit mode. This is screwy -been on this for 2 days and very disenchanted with the new Gridview. You aid you got yours working...do you mind sharing "how" you got it working?
 
Joined
Jul 31, 2006
Messages
2
Reaction score
0
Working with GridView I encountered the same behaviour with the two time clicking. It must have something to do with the control s data stored in viewstate. You can solve your problem, when you re-bind your GridView to the data source in OnRowEditing event handling. If the source is no longer existent, create a DataTable from your GridView data and bind this. (Perhaps you even can rebind the GridView itself...)
 
Last edited:

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

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,273
Latest member
DamonShoem

Latest Threads

Top