| | |
ASP.NET 2.0 Invalid attempt to FieldCount when reader is closed
Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Oct 2006
Posts: 4
Reputation:
Solved Threads: 0
Hi, I'm new here, but I'm hoping that you guys can help me out.
I'm using ASP.NET 2.0 (C#), and I'm having a problem binding a DataReader to a DataGrid. If it makes any difference my IDE is MS Visual Web Developer 2005 Express Edition.
And when I try to run it I get the following error: "Invalid attempt to FieldCount when reader is closed."
Any ideas what I'm doing wrong? Thanks for the help.
I'm using ASP.NET 2.0 (C#), and I'm having a problem binding a DataReader to a DataGrid. If it makes any difference my IDE is MS Visual Web Developer 2005 Express Edition.
ASP.NET Syntax (Toggle Plain Text)
System.Data.OleDb.OleDbConnection dbConnection = null; string strSQL = "SELECT certID, firstName, lastName, OACert, OCCert, initialCertDate, recertDate1, recertDate2, recertDate3, recertDate4, recertDate5, recertDate5, recertDate6, decertDate, decertReason FROM cert INNER JOIN users ON cert.userID = users.userID ORDER BY lastName ASC, firstName ASC"; System.Data.OleDb.OleDbDataReader dr = null; System.Data.OleDb.OleDbCommand dbCmd = null; try { dbConnection = new System.Data.OleDb.OleDbConnection(MyCommon.GetDatabaseString("pts")); dbConnection.Open(); dbCmd = new System.Data.OleDb.OleDbCommand(strSQL, dbConnection); dr = dbCmd.ExecuteReader(); dgCertsAdmin.DataSource = dr; dgCertsAdmin.DataBind() } finally { if (!dbConnection.Equals(null)) if (dbConnection.State.Equals(System.Data.ConnectionState.Open)) dbConnection.Close(); }
Any ideas what I'm doing wrong? Thanks for the help.
![]() |
Similar Threads
- Updated : Simple ASP.Net Login Page (ASP.NET)
- Simple ASP.Net Login Page using C# (C#)
- Forms Authorization/ Authentication using asp .net and vb .net (ASP.NET)
- Simple ASP.Net Login Page (Using VB.Net) (ASP.NET)
- My first attempt at ASP.NET... (ASP.NET)
- Populating & Retrieving Data in a listbox : ASP.NET (w/ VB.NET) (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: Auto Mail in ASP.NET
- Next Thread: Asp.Net Login Page Problem?
| Thread Tools | Search this Thread |
.net 2.0 3.5 ajax alltypeofvideos appliances application asp asp.net beginner box browser businesslogiclayer button c# cac checkbox child class contenttype control countryselector dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol feedback fileuploader fill findcontrol flash flv form gridview gudi iis image javascript list listbox login menu microsoft mouse mssql nameisnotdeclared news novell numerical opera order panelmasterpagebuttoncontrols parent problem radio redirect registration relationaldatabases reportemail schoolproject search security select serializesmo.table sessionvariables silverlight smoobjects software sql sql-server sqlserver2005 ssl tracking treeview validatedate validation vb.net videos vista visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming webservice wizard xsl





