Why ExecuteNonQuery() returning -1 without any exception and without inserting the entry in database?
问题 I have following function: public Exception createTopic(Topic t) { query = "insert into [DisData].[dbo].[discussions]([title],[description],[usrid],[dateadded],[desid],[likes],[shares],[visit],[replyto],[sno]) values(@title,@des,@uid,@dateadded,@did,@like,@share,@visit,@replyto,@sno)"; try { com = new SqlCommand(query, con); com.Parameters.AddWithValue("@title", t.getTitle()); com.Parameters.AddWithValue("@des", t.getDescription()); com.Parameters.AddWithValue("@uid", t.getUsrID()); com