I am unable to see the grid or the data. Here is my code from my .aspx file. I don't know what I am doing wrong:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="resumesearch.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Resume Search</title>
<style type="text/css">
.style1
{
font-size: x-large;
color: #FF0000;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server"
style="font-size: xx-large; font-weight: 700"
Text="RESUME SEARCH"></asp:Label>
<span class="style1">CLICK THE HEADING LINK TO SORT
<asp:GridView ID="GridView1" runat="server" AllowSorting="True"
AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
<asp:BoundField DataField="First Name" HeaderText="First Name"
SortExpression="First Name" />
<asp:BoundField DataField="Last Name" HeaderText="Last Name"
SortExpression="Last Name" />
<asp:BoundField DataField="Address1" HeaderText="Address1"
SortExpression="Address1" />
<asp:BoundField DataField="Address2" HeaderText="Address2"
SortExpression="Address2" />
<asp:BoundField DataField="City" HeaderText="City" SortExpression="City" />
<asp:BoundField DataField="State" HeaderText="State" SortExpression="State" />
<asp:BoundField DataField="Zip" HeaderText="Zip" SortExpression="Zip" />
<asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
<asp:BoundField DataField="Fax" HeaderText="Fax" SortExpression="Fax" />
<asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
<asp:BoundField DataField="School Name" HeaderText="School Name"
SortExpression="School Name" />
<asp:BoundField DataField="College Name" HeaderText="College Name"
SortExpression="College Name" />
<asp:BoundField DataField="Years Completed" HeaderText="Years Completed"
SortExpression="Years Completed" />
<asp:BoundField DataField="Degree" HeaderText="Degree"
SortExpression="Degree" />
<asp:BoundField DataField="Currently Working" HeaderText="Currently Working"
SortExpression="Currently Working" />
<asp:BoundField DataField="Job Title" HeaderText="Job Title"
SortExpression="Job Title" />
<asp:BoundField DataField="Months at Job" HeaderText="Months at Job"
SortExpression="Months at Job" />
<asp:BoundField DataField="Years at Job" HeaderText="Years at Job"
SortExpression="Years at Job" />
<asp:BoundField DataField="Job Category" HeaderText="Job Category"
SortExpression="Job Category" />
<asp:BoundField DataField="Expected Pay" HeaderText="Expected Pay"
SortExpression="Expected Pay" />
<asp:BoundField DataField="Available Start Date"
HeaderText="Available Start Date" SortExpression="Available Start Date" />
</Columns>
</asp:GridView>
</span>
</div>
</form>
</body>
</html> Here is my .aspx.vb (code behind) file:
Imports System.Collections
Imports System.Configuration
Imports System.Data
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Data.OleDb
Imports System.Data.OleDb.OleDbConnection
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load
Dim Panel1 As Panel
Dim Panel2 As Panel
Dim dtCustomerInfo As Data.DataTable
dtCustomerInfo = GetQuery("SELECT * FROM resumetable")
GridView1.DataSource = dtCustomerInfo
GridView1.DataBind()
Panel1.Visible = False
Panel2.Visible = True
End Sub
Private Function GetQuery(strSQL As String) As DataTable
Dim dbConn As Data.OleDb.OleDbConnection
Dim ExecuteReader as System.Data.OleDb.OleDbConnection
Dim cmdSQL As Data.OleDb.OleDbCommand
Dim dtResults As Data.DataTable
dbConn = (New Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\hosting/djbconsulting/access_db/buddyschampion.mdb"))
cmdSQL = New Data.OleDb.OleDbCommand(strSQL, dbConn)
dbConn.Open()
dtResults.Load(cmdSQL.ExecuteReader())
dbConn.Close()
Return dtResults
End Function
End Classis there data in the database?
Thank you so much for emailing me back!
Yes, there is data in the database - I checked it numerous times. Data is being saved to the database, but I am unable to pull the data back into the grid. Everything works fine on my local machine, but this is being hosted by godaddy. I don't know whats going on and they are unable to help me.
The page is: www.buddyschampion.com/resumesearch.aspx . The text shows up but the grid with the data does not. Please help me!
Thanks!
did u place "buddyschampion.mdb" in site
Yes I did. I have two other forms in which a user fills out a form and then clicks the submit button - the data from the form is then saved to the database. This piece works great. Now, the part that isn't working is when I try to pull the data back froom the database and into a data grid. When viewing it on my browser nothing shows up. Please see www.buddyschampion.com/resumesearch.aspx - you will only see text and no data grid holding the data.
Thanks for your help!
hi ,
i read your code.
so i m help you......
first of all you use asp.net use of microsoft so there is some concept...
in this asp.net you use datasource as below of your gridview control..
select that control
and write this code
sqldatasource1.connectionString="youe .mdb connectionSrtring"
sqldatasource1.selectCommand="your select queare"
and after that pass youe sqldatasourceID to your gridview
gridview1.datasourceId=sqldatasource1.id
and then run your web page
i m sure that using this your data is display.
b'cozin asp.net for the data display datasource is complesary
so try and pls........
reply me with this code.....
hi,
did u give read and write permissions for the database in the site.
call u r site hosting agent and ask him to give permissions.
hi , i read your code. so i m help you......
first of all you use asp.net use of microsoft so there is some concept...
in this asp.net you use datasource as below of your gridview control..
select that control and write this code
sqldatasource1.connectionString="youe .mdb connectionSrtring" sqldatasource1.selectCommand="your select queare"and after that pass youe sqldatasourceID to your gridview
gridview1.datasourceId=sqldatasource1.idand then run your web page
i m sure that using this your data is display.
b'cozin asp.net for the data display datasource is complesary
so try and pls........ reply me with this code.....
OK - so once I add the access connection string in the web.config file, how do I call that connection string from my aspx code behind file?
Thanks!