how to open connection in oracle for displying and inserting data in asp.net with vb
12 1478
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.
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 -
<script runat="server">
-
Sub submit(sender As Object, e As EventArgs)
-
dim dbconn,sql,dbcomm,dbread
-
dbconn=New odbcConnection("dsn=Oracle;UserId=starter;Password=starter; " )
-
dbconn.Open()
-
sql="SELECT * FROM students"
-
dbcomm=New odbcCommand(sql,dbconn)
-
dbread=dbcomm.ExecuteReader()
-
customers.DataSource=dbread
-
customers.DataBind()
-
dbread.Close()
-
dbconn.Close()
-
End Sub
-
</script>
-
Problems on connection to oracle databse is resolve by using code - <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
-
<%@ import Namespace="System.Data.ODbc" %>
-
<%@ Import Namespace=" System.Data"%>
-
<script runat="server">
-
sub Page_Load(sender as Object, e as EventArgs)
-
Dim strConnectionString As String
-
strConnectionString = "Dsn=oracle;uid=starter;pwd=starter"
-
Dim pConn As New OdbcConnection(strConnectionString)
-
Dim pSELECTQUERY As String = "SELECT *from test"
-
Dim adapter As New OdbcDataAdapter(pSELECTQUERY, pConn)
-
Dim DS As DataSet = New DataSet()
-
adapter.Fill(DS)
-
pConn.Close()
-
adapter.Dispose()
-
End Sub
-
</script>
-
-
<html>
-
<head>
-
</head>
-
<body>
-
<form runat="server">
-
-
</form>
-
</body>
-
</html>
but on more help required how can disply data from table test thats are in addapter
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.
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
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
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
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
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 - <%@ Page Language="VB" %>
-
<%@ import Namespace="System.Data.ODbc" %>
-
<%@ Import Namespace=" System.Data"%>
-
<script runat="server">
-
sub Page_Load(sender as Object, e as EventArgs)
-
Dim strConnectionString As String
-
strConnectionString = "Dsn=oracle;uid=starter;pwd=starter"
-
Dim pConn As New OdbcConnection(strConnectionString)
-
Dim pSELECTQUERY As String = "SELECT *from students"
-
Dim adapter As New OdbcDataAdapter(pSELECTQUERY, pConn)
-
Dim DS As DataSet = New DataSet()
-
adapter.Fill(DS)
-
Repeater1.DataSource = ds
-
pConn.Close()
-
adapter.Dispose()
-
Repeater1.DataBind()
-
End Sub
-
</script>
-
<html>
-
<head>
-
</head>
-
<body>
-
<form runat="server">
-
<asp:Repeater id="repeater1" runat="server">
-
<HeaderTemplate>
-
<table border="1" width="60%">
-
<tr bgcolor="#CCFF00">
-
<th>
-
ID</th>
-
<th>
-
Major</th>
-
<th>
-
First Name</th>
-
<th>
-
Last Name</th>
-
</tr>
-
</HeaderTemplate>
-
<ItemTemplate>
-
<tr bgcolor="#CCFFCC">
-
<th>
-
<%#Container.DataItem("id")%></th>
-
<th>
-
<%#Container.DataItem("major")%></th>
-
<th>
-
<%#Container.DataItem("first_name")%>
-
</th>
-
<th>
-
<%#Container.DataItem("last_name")%>
-
</th>
-
</tr>
-
</ItemTemplate>
-
<AlternatingItemTemplate>
-
<tr bgcolor="#CCFFFF">
-
<th>
-
<%#Container.DataItem("id")%></th>
-
<th>
-
<%#Container.DataItem("major")%></th>
-
<th>
-
<%#Container.DataItem("first_name")%>
-
</th>
-
<th>
-
<%#Container.DataItem("last_name")%>
-
</th>
-
</tr>
-
</AlternatingItemTemplate>
-
<FooterTemplate>
-
</table>
-
</FooterTemplate>
-
</asp:Repeater>
-
</form>
-
</body>
-
</html>
i try to know whats parts of code should be write in .vb part and .aspx part
thanks
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 .
Thanks
its outstanding supports.
i try to insert data in table .
Regards
jha
Great you are so fast ...
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
|
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,...
|
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...
| |