0
這裏我試圖在表格(調用)中插入一個新行。我試圖得到的唯一值是來自調用者表的caller_id,其餘的都是我已經擁有的字符串。使用INSERT SELECT和VALUES插入到MYSQL數據庫
林不知道我做錯了什麼。如果我沒有弄錯,caller_id是一個外鍵。
string initialcalls = "INSERT INTO calls (is_outbound, is_active, start_time, dealer_no, caller_id,call_id, is_spam, is_voicemail) SELECT"
+ "'@is_outbound', '@is_active', '@start_time', '@dealer_no', @caller_id, '@call_id', '@is_spam', '@is_voicemail' FROM callers WHERE callers.id = @fone;";
MySqlCommand initialCall = new MySqlCommand(initialcalls, connection);
string dealerNO = Regex.Match(items[10], @"\d+").Value;
initialCall.Parameters.AddWithValue("@is_outbound", isOutBound);
initialCall.Parameters.AddWithValue("@is_active", is_active);
initialCall.Parameters.AddWithValue("@start_time", datetimeSQLstart);
initialCall.Parameters.AddWithValue("@dealer_no", dealerNO);
initialCall.Parameters.AddWithValue("@caller_id", selectforcallerid);
initialCall.Parameters.AddWithValue("@call_id", items[0]);
initialCall.Parameters.AddWithValue("@fone", items[8]);
initialCall.Parameters.AddWithValue("@is_spam", isSpam);
initialCall.Parameters.AddWithValue("@is_voicemail", isVoiceMail);
initialCall.ExecuteNonQuery();
this.CloseConnection();
發佈錯誤。 –