R
ryan.d.rembaum
I have posted q couple questions about databinding, but figured I'd
simplify my questions and see if what I want to do is even possible.
I have a database C:\mydatase.mdb
In it there is a table tbleCategory
In that table are two fields fldCat and fldID.
I know how to use ASP and ADO to update a database at a click of a
button by sending dynamically created SQL to the database, but it seems
like there are new methods out there that would be better in that the
database would be aware of collisions (two users modifing data in a
field at the same time via a web page). Is this one of the powers that
databinding offers. If so, can I implement it. I have tried RDS and
..dot and get nothing. Not even an error with the code I am trying.
If I want to bind the Category name column in my database to a text
field, and allow the user to scroll through each record and make
changes, can this be done? Or should I simply continue to use basic
ASP? If it can be done, given the example below, what would the code
look like. Is it simple?
Here is code I tried with the NorthWind database that returned NO
values from the table:
Thanks,
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
sub Page_Load
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data
source=" & server.mappath("C:/Program Files/Microsoft
Office/Office/Samples/northwind.mdb"))
dbconn.Open()
sql="SELECT * FROM customers"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
customers.DataSource=dbread
customers.DataBind()
dbread.Close()
dbconn.Close()
end sub
</script>
<html>
<body>
<form runat="server">
<aspataList
id="customers"
runat="server"
cellpadding="2"
cellspacing="2"
borderstyle="inset"
backcolor="#e8e8e8"
width="100%"
headerstyle-font-name="Verdana"
headerstyle-font-size="12pt"
headerstyle-horizontalalign="center"
headerstyle-font-bold="True"
itemstyle-backcolor="#778899"
itemstyle-forecolor="#ffffff"
footerstyle-font-size="9pt"
footerstyle-font-italic="True">
<HeaderTemplate>
Customers Table
</HeaderTemplate>
<ItemTemplate>
<%#Container.DataItem("companyname")%> in
<%#Container.DataItem("address")%>, <%#Container.DataItem("city")%>
</ItemTemplate>
<FooterTemplate>
Source: Northwind Database
</FooterTemplate>
</aspataList>
</form>
</body>
</html>
simplify my questions and see if what I want to do is even possible.
I have a database C:\mydatase.mdb
In it there is a table tbleCategory
In that table are two fields fldCat and fldID.
I know how to use ASP and ADO to update a database at a click of a
button by sending dynamically created SQL to the database, but it seems
like there are new methods out there that would be better in that the
database would be aware of collisions (two users modifing data in a
field at the same time via a web page). Is this one of the powers that
databinding offers. If so, can I implement it. I have tried RDS and
..dot and get nothing. Not even an error with the code I am trying.
If I want to bind the Category name column in my database to a text
field, and allow the user to scroll through each record and make
changes, can this be done? Or should I simply continue to use basic
ASP? If it can be done, given the example below, what would the code
look like. Is it simple?
Here is code I tried with the NorthWind database that returned NO
values from the table:
Thanks,
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
sub Page_Load
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data
source=" & server.mappath("C:/Program Files/Microsoft
Office/Office/Samples/northwind.mdb"))
dbconn.Open()
sql="SELECT * FROM customers"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
customers.DataSource=dbread
customers.DataBind()
dbread.Close()
dbconn.Close()
end sub
</script>
<html>
<body>
<form runat="server">
<aspataList
id="customers"
runat="server"
cellpadding="2"
cellspacing="2"
borderstyle="inset"
backcolor="#e8e8e8"
width="100%"
headerstyle-font-name="Verdana"
headerstyle-font-size="12pt"
headerstyle-horizontalalign="center"
headerstyle-font-bold="True"
itemstyle-backcolor="#778899"
itemstyle-forecolor="#ffffff"
footerstyle-font-size="9pt"
footerstyle-font-italic="True">
<HeaderTemplate>
Customers Table
</HeaderTemplate>
<ItemTemplate>
<%#Container.DataItem("companyname")%> in
<%#Container.DataItem("address")%>, <%#Container.DataItem("city")%>
</ItemTemplate>
<FooterTemplate>
Source: Northwind Database
</FooterTemplate>
</aspataList>
</form>
</body>
</html>