Re: Connecting to an Oracle Database
From: John Jansen \(MSFT\) (johnjan_at_online.microsoft.com)
Date: 05/04/04
- Next message: John Jansen \(MSFT\): "Re: Trying to find an older posting"
- Previous message: John Jansen \(MSFT\): "Re: Modifying the newform.aspx file"
- In reply to: David McKenzie: "Re: Connecting to an Oracle Database"
- Next in thread: Mike Walsh: "Re: Connecting to an Oracle Database"
- Reply: Mike Walsh: "Re: Connecting to an Oracle Database"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 4 May 2004 15:29:03 -0700
You can also use FrontPage, if you want.
Open your site in FrontPage
Data..Insert Data View
Click Add to Catalog under "Database Connections"
Put in your Oracle connection string in the custom connections dialog
--
Thanks!
John Jansen
Microsoft Office FrontPage
This posting is provided "AS IS" with no warranties, and confers no rights.
"David McKenzie" <DavidMcKenzie@bonbon.net> wrote in message
news:uFd$togMEHA.1900@TK2MSFTNGP10.phx.gbl...
> Hi Steve,
>
> Let me start by saying that database is far from my area of expertise, but
> with some help here I managed the following code:
> Try
>
> '#1: setup the database connection info
>
> oraConn = New OracleConnection(connectionString)
>
> oraCmd = New OracleCommand
>
> '#2: query information
>
> oraCmd.CommandType = CommandType.Text
>
> oraCmd.CommandText = "SELECT ..."
>
> '#3: the OracleCommand object needs to be associated with an active
> connection
>
> oraConn.Open()
>
> oraCmd.Connection = oraConn
>
> oraDA = New OracleDataAdapter(oraCmd) 'executes the query information set
> at
> #2:
>
> myDataSet = New DataSet
>
> mydatagrid = New DataGrid
>
> newColumn = New BoundColumn
>
> 'Define grid columns
>
> ...
>
> Controls.Add(mydatagrid)
>
> ' you can access the data via myDataSet.Tables(0) using the row index.
>
> ' this data can also be bound to a DataGrid with this syntax:
>
> oraDA.Fill(myDataSet)
>
> mydatagrid.DataSource = myDataSet
>
> mydatagrid.DataBind()
>
> '[Text] = Str(mydatagrid.Items.Count)
>
> oraConn.Close()
>
> Catch ex As Exception
>
> oraConn.Close()
>
> [Text] = "Oracle Connection failed" & " - " & ex.Message
>
> End Try
>
>
> "Steve" <webmaster@gottschalks.com> wrote in message
> news:hsff90ld2p7tt0qackon5tlu2k5pbmn5kh@4ax.com...
>> Hi,
>>
>> I am trying to connect to an Oracle database from my web parts. Is
>> there something that I need to configure or some special object that I
>> need to use to get a connection. I am trying to use the OleDb objects
>> in .NET and it just hangs. I use the same code in a normal webform
>> and it works perfectly. I really need to get this working. Any help
>> would be greatly appreciated.
>>
>> Environment:
>>
>> OS: Windows 2003
>> DEV: VS.NET 2003 Architect
>> DB: Oracle 8
>> APP: SharePoint Services 2003
>> SEC: Full Trust
>>
>> CODE SAMPLE:
>>
>> Private Function BuildDataset() As Dataset
>>
>> Dim strSQL As String = "SELECT * FROM <SOMETABLE>"
>> Dim iConn As OleDbConnection = New OleDbConnection("<CONN STRING>")
>> Dim iCmd As OleDbCommand = New OleDbCommand()
>> Dim iAdapter As OleDbDataAdapter
>> Dim oDS As Dataset = New Dataset
>>
>> With iCmd
>> .CommandText = strSQL.ToString
>> .CommandType = CommandType.Text
>> .Connection = iConn
>> End With
>>
>> iAdapter.Fill(oDS)
>>
>> iAdapter.Dispose
>> iCmd.Dispose
>> iConn.Dispose
>>
>> Return oDS
>>
>> This just hangs and returns nothing. If I use similar code against a
>> SQL database I get the dataset with no problems.
>>
>
>
- Next message: John Jansen \(MSFT\): "Re: Trying to find an older posting"
- Previous message: John Jansen \(MSFT\): "Re: Modifying the newform.aspx file"
- In reply to: David McKenzie: "Re: Connecting to an Oracle Database"
- Next in thread: Mike Walsh: "Re: Connecting to an Oracle Database"
- Reply: Mike Walsh: "Re: Connecting to an Oracle Database"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|