Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 7th, 2005, 01:01 AM
Registered User
 
Join Date: Jun 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Connection has not initialized Properly ERROR!!!!

[green][red][black][blue]I Got One Problem while executing my WebForm:
"ExecuteReader: Connection property has not been initialized."
I am posted here my code also....

while executing ExecuteNonQuery method it shows this error!!
amazing i am already innitialize the Connection and Command string as oer my knowledge!!!!
but why his error!!!!!

public static string connstr= System.Configuration.ConfigurationSettings.AppSett ings.Get ("conn");

SqlConnection con=new SqlConnection();



public static string cmdstr=System.Configuration .ConfigurationSettings.AppSettings.Get ("cmdd");

SqlCommand cmd=new SqlCommand();


private void Page_Load(object sender, System.EventArgs e)

{
gridfill(DataGrid1 ,"");
con.ConnectionString =connstr;
}
private void Button1_Click(object sender, System.EventArgs e)
{
SqlParameter p1=new SqlParameter ("@num",SqlDbType.Int ,4,"num");
p1.Direction =ParameterDirection.Input ;
p1.Value =TextBox1.Text ;
SqlParameter p2=new SqlParameter ("@name",SqlDbType.Char ,2 ,"name");
p2.Direction =ParameterDirection.Input ;
p2.Value =TextBox2.Text ;
SqlParameter p3=new SqlParameter ("@job",SqlDbType.Char ,2,"job");
p3.Direction =ParameterDirection.Input ;
p3.Value =TextBox3.Text ;
cmd.CommandType=CommandType.StoredProcedure ;
cmd.CommandText="insert_rams";
cmd.Parameters .Add (p1);
cmd.Parameters .Add (p2);
cmd.Parameters .Add (p3);
try
{
con.Open ();
cmd.ExecuteNonQuery ();
Response.Write ("Inserted successfully...");
}
catch(Exception ex)
{
Response.Write (ex.Message );
}finally
{con.Close ();
}


giv any suggestions it gerate help full for me!!!!


thanks@@@@Ramas123






Similar Threads
Thread Thread Starter Forum Replies Last Post
Connection property has not been initialized sasi.vempalli ASP.NET 1.0 and 1.1 Basics 0 September 19th, 2006 03:03 AM
ConnectionString not initialized samiboy ASP.NET 2.0 Basics 2 April 30th, 2006 06:18 AM
Connection Property:Has not been initialized louie001 ASP.NET 1.0 and 1.1 Basics 1 October 17th, 2005 11:46 PM
connection not initialized jazzcatone ASP.NET 1.x and 2.0 Application Design 1 July 29th, 2005 01:02 PM
which you have not initialized Gurpreetb78 Classic ASP Components 0 January 27th, 2005 03:42 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.