Home All Groups Group Topic Archive Search About

Working with Gridview & Oracle

Author
20 Jan 2006 4:50 PM
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

Author
20 Jan 2006 5:02 PM
anonymike
Okay, ignore question 2, I got it figured out.
Author
20 Jan 2006 5:21 PM
Jim Heavey
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.
Author
20 Jan 2006 5:30 PM
Phillip Williams
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


Show quote
"anonym***@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
>
>
Author
20 Jan 2006 6:55 PM
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

AddThis Social Bookmark Button