473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

how to open connection

idsanjeev
241 100+
how to open connection in oracle for displying and inserting data in asp.net with vb
Jun 25 '08 #1
12 1478
Curtis Rutland
3,256 Expert 2GB
Don't be lazy. Have you tried anything yet? Have you tried searching google for a tutorial yet? Connecting to oracle is no different than connecting to any other db. All you need is a different connection string.

I'll even get you started on what to look for: OleDbConnection, OleDbCommand, and OleDbDataAdapter. All in System.Data.OleDb.
Jun 25 '08 #2
idsanjeev
241 100+
ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr).
ERROR [01S00] [Microsoft][ODBC driver for Oracle]Invalid connection string attribute
Expand|Select|Wrap|Line Numbers
  1. <script runat="server">
  2.     Sub submit(sender As Object, e As EventArgs)
  3.     dim dbconn,sql,dbcomm,dbread
  4.     dbconn=New odbcConnection("dsn=Oracle;UserId=starter;Password=starter; " )
  5.     dbconn.Open()
  6.     sql="SELECT * FROM students"
  7.     dbcomm=New odbcCommand(sql,dbconn)
  8.     dbread=dbcomm.ExecuteReader()
  9.     customers.DataSource=dbread
  10.     customers.DataBind()
  11.     dbread.Close()
  12.     dbconn.Close()
  13.     End Sub
  14. </script>
  15.  
Jun 26 '08 #3
idsanjeev
241 100+
Problems on connection to oracle databse is resolve by using code
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
  2. <%@ import Namespace="System.Data.ODbc" %>
  3. <%@ Import Namespace=" System.Data"%>
  4. <script runat="server">
  5. sub Page_Load(sender as Object, e as EventArgs)
  6.      Dim strConnectionString As String
  7.         strConnectionString = "Dsn=oracle;uid=starter;pwd=starter"
  8.         Dim pConn As New OdbcConnection(strConnectionString)
  9.         Dim pSELECTQUERY As String = "SELECT  *from test"
  10.         Dim adapter As New OdbcDataAdapter(pSELECTQUERY, pConn)
  11.         Dim DS As DataSet = New DataSet()
  12.         adapter.Fill(DS)
  13.         pConn.Close()
  14.         adapter.Dispose()
  15.     End Sub
  16. </script>
  17.  
  18. <html>
  19. <head>
  20. </head>
  21. <body>
  22.     <form runat="server">
  23.  
  24.     </form>
  25. </body>
  26. </html>
but on more help required how can disply data from table test thats are in addapter
Jun 27 '08 #4
nmsreddi
366 256MB
Hello ,

by looking to your code ,now the data is available in your Dataset DS,

you can use that dataset as Datasource for your required control.
Jun 27 '08 #5
idsanjeev
241 100+
Hello ,

by looking to your code ,now the data is available in your Dataset DS,

you can use that dataset as Datasource for your required control.
Yes data is in ds,but don't know how to control my data in ds to prints
Jun 27 '08 #6
nmsreddi
366 256MB
Hello

what that Prints indicate , you want to print the data in DS,

what controls you are using to display data , any GridView Control or generating report .

what exactly you are looking for , please post complete requirement


Regards
nmsreddi
Jun 27 '08 #7
idsanjeev
241 100+
Hello
what exactly you are looking for , please post complete requirement
Regards
nmsreddi
I am looking for way to display data in ds with Repeater or datagrid but don't how to disply with it
Jun 27 '08 #8
nmsreddi
366 256MB
Hello

add a gridview control then

GridViewcontrol1.datasource=ds.Tables[0];
GridViewcontrol1.databind();

thats all the data will bind to datagrid.

else google for binding data to DataGrid you will get plenty of example codes
Jun 27 '08 #9
idsanjeev
241 100+
Hello
add a gridview control then
GridViewcontrol1.datasource=ds.Tables[0];
GridViewcontrol1.databind();
thats all the data will bind to datagrid.
else google for binding data to DataGrid you will get plenty of example codes
Thanks for your kind supports problems are now solved my full code is
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="VB" %>
  2. <%@ import Namespace="System.Data.ODbc" %>
  3. <%@ Import Namespace=" System.Data"%>
  4. <script runat="server">
  5. sub Page_Load(sender as Object, e as EventArgs)
  6.      Dim strConnectionString As String
  7.         strConnectionString = "Dsn=oracle;uid=starter;pwd=starter"
  8.         Dim pConn As New OdbcConnection(strConnectionString)
  9.         Dim pSELECTQUERY As String = "SELECT  *from students"
  10.         Dim adapter As New OdbcDataAdapter(pSELECTQUERY, pConn)
  11.         Dim DS As DataSet = New DataSet()
  12.         adapter.Fill(DS)
  13.          Repeater1.DataSource = ds
  14.         pConn.Close()
  15.         adapter.Dispose()
  16.         Repeater1.DataBind()
  17.     End Sub
  18. </script>
  19. <html>
  20. <head>
  21. </head>
  22. <body>
  23.     <form runat="server">
  24.         <asp:Repeater id="repeater1" runat="server">
  25.             <HeaderTemplate>
  26.                 <table border="1" width="60%">
  27.                     <tr bgcolor="#CCFF00">
  28.                         <th>
  29.                             ID</th>
  30.                         <th>
  31.                             Major</th>
  32.                         <th>
  33.                             First Name</th>
  34.                         <th>
  35.                             Last Name</th>
  36.                     </tr>
  37.             </HeaderTemplate>
  38.             <ItemTemplate>
  39.                 <tr bgcolor="#CCFFCC">
  40.                     <th>
  41.                         <%#Container.DataItem("id")%></th>
  42.                     <th>
  43.                         <%#Container.DataItem("major")%></th>
  44.                     <th>
  45.                         <%#Container.DataItem("first_name")%> 
  46.                     </th>
  47.                     <th>
  48.                         <%#Container.DataItem("last_name")%> 
  49.                     </th>
  50.                 </tr>
  51.             </ItemTemplate>
  52.             <AlternatingItemTemplate>
  53.                 <tr bgcolor="#CCFFFF">
  54.                     <th>
  55.                         <%#Container.DataItem("id")%></th>
  56.                     <th>
  57.                         <%#Container.DataItem("major")%></th>
  58.                     <th>
  59.                         <%#Container.DataItem("first_name")%> 
  60.                     </th>
  61.                     <th>
  62.                         <%#Container.DataItem("last_name")%> 
  63.                     </th>
  64.                 </tr>
  65.             </AlternatingItemTemplate>
  66.             <FooterTemplate>
  67.                 </table>
  68.             </FooterTemplate>
  69.         </asp:Repeater>
  70.     </form>
  71. </body>
  72. </html>
i try to know whats parts of code should be write in .vb part and .aspx part
thanks
Jun 27 '08 #10
nmsreddi
366 256MB
Hello

all code related Vb.net should be written in .vb file nothing but codebehing

all the Html and scripts will be written in .aspx.

you can also have both the vb.net code and script in the single page ,thats what you have done .

while starting the application it self you have to select whether to place code in separate code behind file or not .
Jun 27 '08 #11
idsanjeev
241 100+
Thanks
its outstanding supports.
i try to insert data in table .
Regards
jha
Jun 27 '08 #12
nmsreddi
366 256MB
Great you are so fast ...
Jun 27 '08 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: B B | last post by:
Okay, here is what's happening: I have a reasonably fast laptop (1.4 GHz Mobile M, so comparable to 2.5GHz P4) doing .net development. Running Windows XP pro, SP2 IIS is installed and running...
20
by: fniles | last post by:
I am using VB.NET 2003, SQL 2000, and SqlDataReader. As I read data from tblA, I want to populate tblB. I use SQLDataReader for both tables. I do not use thread. When I ExecuteReader on tblB, I...
7
by: fniles | last post by:
I am using VB.Net 2003 and MS Access (connecting using OleDBConnection). I read using DataAdapter and DataSet, not DataReader. When many people try to access the database at the same time, I get...
5
by: Usman Jamil | last post by:
Hi I've a class that creates a connection to a database, gets and loop on a dataset given a query and then close the connection. When I use netstat viewer to see if there is any connection open...
2
by: Tony Johansson | last post by:
Hello! How does this connection pool function actually ? As I have been told is that when the connection is returned to the pool the connection to the database is still open. What you do is that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.