Click here to Skip to main content
15,901,853 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
m nw in asp.net plzzz tel me d meaning of syntax:

cmd.connection=con;

n where to use it??? :sigh:
Posted

Firstly, Use proper words, please, the, etc.

This code snippet looks like a SQL command object has been instanced and assigned to cmd.

A data connection has been instanced and assigned the name con.

So, the command object is being told which connection is being used.
cmd.connection=con;

Giventhe fact there is a ; at the end would suggest that this has also been coded using C#.

Happy?
 
Share this answer
 
You may need to learn the meaning of basic spelling first. We can work on things such as syntax and grammar at a later date.
 
Share this answer
 
v2
Comments
Richard MacCutchan 25-Jun-10 9:15am    
grammer?
thatraja 26-Feb-11 11:09am    
5!:)
this example show you what this mean : http://www.java2s.com/Code/VB/Database-ADO.net/Connectionstatechangeevent.htm

and try to use VB.Net to C#[^] for you got :

32	        con = new SqlConnection("Server=(local)\\SQLEXPRESS;Initial Catalog=MyDatabase;Integrated Security=SSPI");
33	 
34	        SqlCommand cmd = new SqlCommand();
35	        cmd.CommandText = "SELECT TOP 5 FirstName, LastName FROM Employee";
36	        cmd.Connection = con; // YOU ARE HERE ^_^
37	 
 
Share this answer
 
Comments
Sandeep Mewara 25-Jun-10 11:16am    
Reason for my vote of 1
OP is a beginner and posting these stuffs would not lead him anywhere!
#realJSOP 25-Jun-10 12:28pm    
@sandeep - sometimes the answer isn't suitable for beginners...
Adrabi Abderrahim 25-Jun-10 12:47pm    
O_O aw! this just copy/paste any beginners can do it easily? if he know this used for SQL, can known his way? (what's needed to be searched)
Adrabi Abderrahim 25-Jun-10 12:53pm    
^_^ okay! I admit my fault!
shahina gupta 26-Jun-10 8:27am    
ya i have just started ASP.NET from last one week plz guide me in this field i find it quite difficult to approach it....
From your other posts, it's clear that you have just started coding!

I would suggest you to pick a good book or go through some tutorials. Learn and try basic stuffs.

Flooding with questions like this won't help you. You need to put some effort from your side.
 
Share this answer
 
Comments
shahina gupta 26-Jun-10 8:24am    
ok then plz suggest me some good books . i have read some books but they are not good enough...
Sandeep Mewara 26-Jun-10 8:43am    
Pick any beginner book of good publication like Apress or O'riely for now. Not sure what you read.
Apart from them:
http://msdn.microsoft.com/en-gb/default.aspx
http://www.asp.net/
They should help you.

Google for anything you are trying on. You will get lots of material to read on.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900