2011-04-12 6 views
-2

다음 쿼리를 사용하여 asp.net의 레코드를 업데이트하고 있는데, 무엇이 문제입니까? 내가 당신을 믿지ASP.NET의 Sql 쿼리

Dim updateSqlString As String = "UPDATE Subscriber_Communication SET([[marketing_rec_id]=?, [Currently_own]=?,[Purchase_date]=?, [Interested_in_owning]=?, [Product_of_interest]=?," & _ 
"[Time_frame_to_own]=?, [Referred_by]=?, [Campaign_Code]=?,[Last_Update]=?, [record_created_on]=?, [Comments]=?, [Comment_Date]=?, [Community_id]=?," & _ 
"[Certification]=?, [subscriber_Type]=?, [unsubscribe_comment]=?" & _ 
"WHERE [Communication_id]=" & Communication_id 
    Using conn As New SqlConnection(ConnString) 
      Using cmd As New SqlCommand(insertSqlString, conn) 
       cmd.CommandType = CommandType.Text 
       cmd.Parameters.AddWithValue("marketing_rec_id", marketing_rec_id) 
       cmd.Parameters.AddWithValue("Currently_own", Currently_own) 
       cmd.Parameters.AddWithValue("Purchase_date", Purchase_date) 
       cmd.Parameters.AddWithValue("Interested_in_owning", Interested_in_owning) 
       cmd.Parameters.AddWithValue("Product_of_interest", Product_of_interest) 
       cmd.Parameters.AddWithValue("Time_frame_to_own", Time_frame_to_own) 
       cmd.Parameters.AddWithValue("Referred_by", Referred_by) 
       cmd.Parameters.AddWithValue("Campaign_Code", Campaign_Code) 
       cmd.Parameters.AddWithValue("Last_Update", Last_Update) 
       cmd.Parameters.AddWithValue("record_created_on", record_created_on) 
       cmd.Parameters.AddWithValue("Comments", Comments) 
       cmd.Parameters.AddWithValue("Comment_Date", Comment_Date) 
       cmd.Parameters.AddWithValue("Community_id", Community_id) 
       cmd.Parameters.AddWithValue("Certification", Certification) 
       cmd.Parameters.AddWithValue("subscriber_Type", subscriber_Type) 
       cmd.Parameters.AddWithValue("unsubscribe_comment", unsubscribe_comment) 
       conn.Open() 
       cmd.ExecuteNonQuery() 
      End Using 
     End Using 
+4

무엇이 잘못 되었나요? 실패합니까? 레코드를 업데이트하지 않습니까? 다른 건 없니? –

+0

업데이트되지 않습니다. 올바른 구문입니까? – hotcoder

답변

1

당신은

updateSqlString

로 문자열 변수를 가지고 당신이

01을 사용하는 동안

insertSqlString

데이터베이스를 업데이트하려면 다음을 수행하십시오.