Para criarmos uma aplicação que conecta com uma base de dados Oracle ®, via ASP.NET, vamos utilizar o Visual Studio 2010 ®.
Instruções
Criaremos um projeto utilizando o framework 3.5 (pode-se utilizar o framework 4.0, caso deseje).
Após criado o projeto, insira no arquivo Default.aspx um gridview. Será este componente que receberá as informações de sua base Oracle ®.
Clique com o lado direito do mouse em seu controle gridview e selecione a opção “Show Smart Tag”.
Feito isso, será habilitado ao lado do controle, a janela “Gridview Tasks” que possibilitará a configuração do data source vinculado à gridview criada. No combo box da opção “Choose Data Source”, escolha “New Data Source”. Desta forma, será iniciada o wizard de configuração do data source. Escolha o “SQL Database”, local este em que o aplicativo obterá os dados. Em nosso exemplo, definimos o ID como “Oracle”. A opção “SQL Database” é compatível com bases de dados Oracle ®.
Na próxima tela, escolha a opção “New Connection”.
Não opte pelo data provider padrão. Clique no botão “Change…”, para escolher outro. Na próxima tela, escolha o data provider “.NET Framework Data Provider for OLE DB”.
Agora, vamos inserir os dados de sua base Oracle ®. Insira o nome do servidor, user e a senha da base. Para a inclusão do server name deve-se seguir o padrão “IP:Porta/Instância”. Em nosso exemplo, nossa base possui o IP “000.000.000.000”, instância “LOCAWEB_1” e user name “baselocaweb”. Obrigatoriamente, deve-se utilizar a porta 1521.
Após a inserção de dados, Clique no botão “Test Connection” para testar a conexão. Com a conexão validada, clique em “OK” para continuar.
Pode-se verificar a conexão criada, inclusive a “Connection String” criada automaticamente (Quando você for criar a conexão, serão apresentados os dados de sua base).
Na próxima tela, é optativa a gravação da string de conexão criada em sua aplicação. Em nosso exemplo, salvamos a string como o nome “OracleConn”.
Agora, podemos definir a query que queremos utilizar em nossa gridview. Utilizamos um “SELECT * FROM TABELA” para ilustrar. Na próxima tela, é possível testar sua query ou, caso queira, pode-se finalizar a configuração. E, com isso, sua gridview apresentará os dados presentes em sua base Oracle ® (Quando você for criar a conexão, serão apresentados os dados de sua base).
Dicas
Caso queira, é possível alterar a query criada no wizard acessando diretamente o “SelectCommand” da gridview. O caminho da conexão também é alterável, pelo arquivo web.config. Rocomenda-se que tais alterações sejam feitas antes de compilar sua aplicação.
Referências Externas
Veja também
Oracle Server X5-8 is the most powerful and flexible 8-socket x86 server we’ve ever designed.
Not Found
The requested URL /us/mosaicmenu/index.html was not found on this server.
Make your trading dreams come true and start earning up to $5000 a day.
The more you make, the higher our collective gains.Copy Binary Options Trades
Hi to all, how is everything, I think every
one is getting more from this web site, and your views are fastidious for
new viewers.
Временная регистрация в Санкт-Петербурге
Hi there, this weekend is good designed for
me, because this moment i am reading this fantastic educational
article here at my residence.
Feel free to visit my site – Myht Co
временная регистрация в санкт-петербурге
This post will assist the internet viewers for creating new web site or even a weblog from start to end.
прописка в санкт-петербурге
You actually make it seem so easy with your presentation but I find this topic to be really something that I think I would never understand. It seems too complicated and extremely broad for me. I’m looking forward for your next post, I will try to get the hang of it!
I think this is among the most vital info for me. And i’m glad reading your article. But should remark on some general things, The site style is wonderful, the articles is really great : D. Good job, cheers
Hi there, I enjoy reading all of your article post. I wanted to write a little comment to support you.
Hello there! This is kind of off topic but I need some advice from an established blog.
Is it very difficult to set up your own blog? I’m not
very techincal but I can figure things out pretty quick.
I’m thinking about setting up my own but I’m not sure where to
begin. Do you have any ideas or suggestions? Cheers
I am really inspired with your writing talents as well as with the structure for your weblog.
Is this a paid topic or did you customize it your self?
Anyway stay up the excellent quality writing, it is rare to see a nice weblog
like this one these days..
I am truly glad to glance at this weblog posts which carries plenty of valuable information, thanks for providing these statistics.
Hey! This is kind of off topic but I need some help from an established blog. Is it hard to set up your own blog? I’m not very techincal but I can figure things out pretty quick. I’m thinking about creating my own but I’m not sure where to start. Do you have any points or suggestions? With thanks
порно 03
Very nice post. I just stumbled upon your weblog
and wanted to say that I have really enjoyed surfing around
your blog posts. In any case I’ll be subscribing to your rss feed and
I hope you write again soon!
Hey there would you mind letting me know which web host you’re
using? I’ve loaded your blog in 3 completely different browsers and I must say this blog loads a lot faster then most.
Can you suggest a good hosting provider at a fair price?
Thanks, I appreciate it!
Hey There. I found your blog using msn. This is a very well written article.
I’ll be sure to bookmark it and return to read
more of your useful information. Thanks for the post. I will certainly return.
It’s not my first time to pay a visit this
web page, i am browsing this web page dailly and get good facts from here everyday.