الاثنين، 31 أغسطس 2015

مشكلة فى تنفيذ جملة com.ExecuteNonQuery فى asp.net

ExecuteNonQuery: Connection property has not been initialized.

-عندما تريد ان تعرف عدد الصفوف المتأثرة فى الداتا بيز فانك تستخدم الجملة التاليه 

()int x = com.ExecuteNonQuery 

** ولكن يظهر لك خطأ عند التنفيذ ان الاتصال لم يتم !
قبل الانتهاء من كتابة الاتصال واغلاقه وماتحتاجه من تنفيذ 
 ;  SqlConnection conn
;    SqlCommand com
;()conn = new SqlConnection
   
 ;()  com = new SqlCommand
 ;""=conn.ConnectionString 

 ; com.CommandType= CommandType.StoredProcedure

**لابد من مساوة اتصال ال SqlCommand ب  SqlConnection

الحل اضافة السطر الاتى :


;com.Connection = conn




*************************************************
:error 
.ExecuteNonQuery: Connection property has not been initialized

:sol
put command equal connection
You need to assign the connection to the SqlCommand"
 "you can use the constructor or the property

; com.Connection = conn


EmoticonEmoticon

:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:o
:>)
(o)
:p
:-?
(p)
:-s
8-)
:-t
:-b
b-(
(y)
x-)
(h)