I am not using VS.Net and how can i display the data after retrive it from database?
what should i use?
I tried this and and there is an error
<%#DataBinder.Eval(Container.DataItem, “ProductName”)%>
i tried this also and there is an error:
<%Response.write(Productname)>
my sql is select Productname from Table where ID= 123
Dim connection = New OleDbConnection( _
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("database.mdb") & ";")
Dim sql = "select * from product where Id='" + "123" + "'"
Dim command = New OleDbCommand(sql, connection)
connection.Open()
Dim reader = command2.executeReader()
If reader.hasRows Then
reader.read()
End If
This is my code… how to display it on aspx page thanks
Well, if someone had introduce me that page one month ago. I would love to go through the website but i got like less than 5 hours before my assignment is dude. i only left this part.
Dim connection As OleDbConnection = New OleDbConnection( _
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("database.mdb") & ";")
Dim sql As String = "select * from product where Id='" + "123" + "'"
Dim command As OleDbCommand = New OleDbCommand(sql, connection)
connection.Open()
Dim reader As OleDbDataReader = command2.executeReader()
If reader.hasRows Then
reader.read()
Response.Write(reader("ProductName"))
End If
Dim connection As OleDbConnection = New OleDbConnection( _
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("database.mdb") & ";")
Dim sql As String = "select * from product where Id='" + "123" + "'"
Dim command As OleDbCommand = New OleDbCommand(sql, connection)
connection.Open()
Dim reader As OleDbDataReader = command2.executeReader()
If reader.hasRows Then
reader.read()
txtProductName.text = reader("ProductName").ToString()
End If
Then add a field in your Page class, let’s call it ProductName, then assign the database value to that field in output it in the aspx page with Response.Write
public partial class _Default Inherits System.Web.UI.Page
{
Protected ProductName As String
Public Sub Page_Load(sender As Object, e As EventArgs)
Dim connection As OleDbConnection = New OleDbConnection( _
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("database.mdb") & ";")
Dim sql As String = "select * from product where Id='" + "123" + "'"
Dim command As OleDbCommand = New OleDbCommand(sql, connection)
connection.Open()
Dim reader As OleDbDataReader = command2.executeReader()
If reader.hasRows Then
ProductName = reader("ProductName").ToString()
End If
End Sub
}