TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
reddish_eg
NA
9
0
connection class
May 31 2004 7:47 AM
I've written a connection class to use in all my files: [code] using System; using System.Web; using System.Web.UI; using System.Data; using System.Data.SqlClient; public class DataBaseConnection : Page { public SqlConnection connection; public SqlConnection conn() { connection = new SqlConnection(); connection.ConnectionString = "Trusted_Connection = yes; initial catalog=''; data source=''; Connect Timeout=30 "; connection.Open(); return connection; } } [/code] That is how I import it to my .aspx files: [code] <%@Page Inherits="DataBaseConnection" Src="Connection.cs"%> <%@ Import Namespace="System.Data"%> <%@ Import Namespace="System.Data.SqlClient"%> [/code] This code is supposed to view the table called "Banks". It worked fine before when I wrote the code of connection in the file. Now, I get this error: [code] Exception Details: System.InvalidOperationException: ExecuteReader: Connection property has not been initialized Line 156: reader = command.ExecuteReader(); [/code] Anything? Thank you.
Reply
Answers (
1
)
datagrid
Error executing child request for ......