在代码后面我有这个:
protected void ButtonSave_Click(object sender, EventArgs e)
{
Guid guid = (Guid)Membership.GetUser().ProviderUserKey;
string name = TextBoxCategoryName.Text;
// string user = Membership.GetUser().UserName;
this.connection.Open();
command = connection.CreateCommand();
command.CommandText = "insert into ProfitCategories(name, IdUser) values ( '" + name + "', "+guid+" )";
command.ExecuteNonQuery();
connection.Close();
}
但这给出了错误:Incorrect syntax near 'a8'.
如何从当前用户获取 GUID 并插入数据库