问题描述
我有sql查询
字符串strQuery =从[USER]中删除RoomID =" +会话["CURRENTROOM_ID"].ToString()+"AND ugid =" + strID;
我从另一个页面传递了ugid,它工作正常
我想修改sql查询以删除其中的行
ugid ="+ strID
nick ="+ strID1
ip ="+ strID2
LoggedTime ="+ strID3
我可以传递所有值,只需要sql查询即可.
每当我得到尝试,我都会尽一切努力
将nvarchar值转换为数据类型为int的列时出错.
有人可以帮我吗
注意:
[ugid] [bigint] NOT NULL约束[DF_ChatUser_ugid]默认((0)),
[nick] [nvarchar](50)收集SQL_Latin1_General_CP1_CI_AS NULL,
[ip] [nvarchar](20)收集SQL_Latin1_General_CP1_CI_AS NULL,
[LoggedTime] [datetime] NULL
i have sql query
string strQuery = "DELETE FROM [USER] WHERE RoomID=" + Session["CURRENTROOM_ID"].ToString() + " AND ugid=" + strID;
i pass the ugid from another page and it work fine
i want to modify sql query to delete row where
ugid=" + strID
nick=" + strID1
ip=" + strID2
LoggedTime=" + strID3
i can pass all the value fine only need the sql query
i tried everything every time i get
error converting the nvarchar value to a column of data type int.
can anyone help me with that
note :
[ugid] [bigint] NOT NULL CONSTRAINT [DF_ChatUser_ugid] DEFAULT ((0)),
[nick] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ip] [nvarchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[LoggedTime] [datetime] NULL
推荐答案
int x = new int();
x = int.Parse(strID);
ugid=" + x
nick=" + strID1
ip=" + strID2
LoggedTime=" + strID3
这篇关于删除sql行asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!