0

i'll attach a little snippet:

comd = New OdbcCommand("INSERT INTO news (new_title, new_content) VALUES (@newTitle, @newContent)", conn)
            
            comd.Parameters.Add("@newTitle", OdbcType.Text)
            comd.Parameters("@newTitle").Value = newsTitle.Text
            comd.Parameters.Add("@newContent", OdbcType.Text)
            comd.Parameters("@newContent").Value = FCKeditor1.Value
           

            conn.Open()
            comd.ExecuteNonQuery()
            Response.Redirect("default.aspx")

this code executes, and my database is updated, but the new_title and new_content fields are still NULL. i've tested by setting an error message label to the values of newsTitle.Text and comd.Parameters("@newTitle").Value, and the message label always shows the appropriate value... why aren't the values and my parameters connecting?

4
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by finito
-3
comd = new OleDbCommand();
comd.CommandText="INSERT INTO news (new_title, new_content) VALUES (@newTitle, @newContent";

comd.Connection=conn.getConnection();

comd.Parameters.AddWithValue("@vin",VIN);
comd.Parameters.AddWithValue("@price",price);
comd.Parameters.AddWithValue("@trandate",aDate);
comd.Parameters.AddWithValue("@trantype",transType);
            
comd.Connection.Open();
comd.ExecuteNonQuery();
comd.Connection.Close();
Response.Redirect("default.aspx")
0

comd.Parameters.Add("@newTitle", OdbcType.Text).Value = newsTitle.Text

try by this way and let us know !!

0

Try this. If it can't solve then post -complete- markup and code here.

comd = New OdbcCommand("INSERT INTO [news] (new_title, new_content) values(@newTitle, @newContent)", conn)
            
comd.Parameters.AddWithValue("@newTitle",newsTitle.Text)
comd.Parameters.AddWithValue("@newContent",newsContent.Text)

conn.Open()
comd.ExecuteNonQuery()
conn.Close()
Response.Redirect("default.aspx")

Edited by __avd: n/a

0

i don't understand your reply.

sorry, I was half asleep what adapost did. That was his solution anyway.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.