然后使用以下脚本创建表hovertree_usermessage
use [hovertree] go /****** object: table [dbo].[hovertree_usermessage] ******/ set ansi_nulls on go set quoted_identifier on go create table [dbo].[hovertree_usermessage]( [hvtid] [int] identity(1,1) not null, [hvttitle] [nvarchar](500) null, [hvtcontent] [nvarchar](max) null, [hvtuser] [nvarchar](50) null, [hvttime] [datetime] null, [hvtreply] [nvarchar](max) null, [hvtisshow] [bit] null, constraint [pk_hovertree_usermessage] primary key clustered ( [hvtid] asc )with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_page_locks = on) on [primary] ) on [primary] go alter table [dbo].[hovertree_usermessage] add constraint [df_hovertree_usermessage_hvttime] default (getdate()) for [hvttime] go
那么c#使用keleyisqlhelper类往数据库添加数据的代码为:
c#代码
string m_sql="insert into hovertree_usermessage (hvttitle,hvtcontent,hvtuser)values(" +sqltools.getquotes(txttitle.text)+"," + sqltools.getquotes(txtcontent.text)+"," +sqltools.getquotes(txtuser.text) +")"; keleyisqlhelper.executesql(m_sql);
其中txttitle、txtcontent、txtuser为asp.net的textbox控件
