23-02-2010, 14:55
|
|
|
חבר מתאריך: 01.10.09
הודעות: 10
|
|
ASP.net + SQL | צריך להכניס נתונים למקום עם פורמט של varbinary.
שלום חברים
יש לי COLUMN באיזה טבלה עם פורמט varbinary עכשיו, אני צריך להכניס לשם נתונים (בעצם אני יודע פחות או יותר איזה נתונים) אבל כל הנושא עם הפירמוטים מבלבל אותי..
אינה קוד שרשמתי והוא לא עובד כי הוא מנסה לפרמט את מה שאמרתי לו להכניס לשם לvarbinary כאשר זה כבר varbinary אינה הקוד:
קוד:
private void ExecuteInsert(string code)
{
SqlConnection con = new SqlConnection(conString);
string sql = "INSERT INTO CharItemEx (TempInven) VALUES "
+ " (@Code)" + "WHERE CID = 3";
try
{
con.Open();
SqlCommand cmd = new SqlCommand(sql, con);
SqlParameter[] param = new SqlParameter[1];
//param[0] = new SqlParameter("@id", SqlDbType.Int, 20);
param[0] = new SqlParameter("@Code", SqlDbType.VarBinary, 1440);
param[0].Value = code;
וכמובן אינה הכפתור שמפעיל את הפקודה לאחר שכתבתי בBOX את הקוד:
קוד:
protected void Button1_Click(object sender, EventArgs e)
{
//call the method to execute insert to the database
ExecuteInsert(TxtCode.Text);
Response.Write("Record was successfully added!");
ClearControls(Page);
}
וזה הBOX עצמו:
קוד:
<asp:TextBox ID="TxtCode" runat="server">
תעזרו בבקשה חברים
|