using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[WebMethod]
public static string SaveLayout(string layout, object state)
{
SqlConnection conn = new SqlConnection(@"Persist Security Info=False;User ID=admin;Password=admin123;Initial Catalog=Test_Layout;Data Source=Myserver");
conn.Open();
SqlCommand cmd = new SqlCommand("insertlayout", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@layout", layout);
cmd.Parameters.AddWithValue("@states", state);
cmd.ExecuteNonQuery();
conn.Close();
return "successfully state saved";
}
}
我使用的WebMethod(使用JSON,jQuery的)存儲對象在SQL Server 2008 但我得到的SQL Server 2008上下面的錯誤我使用爲varchar(最大值存在)數據類型,用於存儲對象(狀態變量)在數據庫如何狀態變量(對象)轉換爲字符串在數據庫沒有映射從對象類型C#
存儲3210