随笔分类 -  ado.net

摘要:[AcceptVerbs("GET", "POST")] public HttpResponseMessage Http([FromUri]ProxyHttpParam getParam, ProxyHttpParam postParam) { var res = new HttpResponseM 阅读全文
posted @ 2020-04-12 00:35 microsoftzhcn 阅读(1064) 评论(0) 推荐(0)
摘要:获取周数据 获取月数据 阅读全文
posted @ 2020-01-17 14:12 microsoftzhcn 阅读(2566) 评论(0) 推荐(0)
摘要:问题描述: 数据库的事务日志已满,起因为"LOG_BACKUP"。 解决方法: 1).选择数据库–属性—选项—恢复模式–选择简单。2).收缩数据库后,再调回完整。 阅读全文
posted @ 2019-05-24 14:26 microsoftzhcn 阅读(6767) 评论(0) 推荐(0)
摘要:查询大于2分钟的数据select * from dt_appsdk_users where datediff(mi,update_time,getdate()) > 2 阅读全文
posted @ 2018-10-23 17:39 microsoftzhcn 阅读(193) 评论(0) 推荐(0)
摘要:DECLARE @test intSET @test=nullselect isnull(@test,0) 阅读全文
posted @ 2018-06-28 20:33 microsoftzhcn 阅读(3255) 评论(0) 推荐(0)
摘要:一、定义变量--简单赋值 declare @a intset @a=5 print @a --使用select语句赋值 declare @user1 nvarchar(50) select @user1='张三'print @user1 declare @user2 nvarchar(50) sel 阅读全文
posted @ 2018-06-26 10:19 microsoftzhcn 阅读(4243) 评论(0) 推荐(1)
摘要:存储过程的种类: 1.系统存储过程。 以sp_开头 2.扩展存储过程。 以xp_开头 3.用户定义存储过程。 SQL 循环 阅读全文
posted @ 2018-06-26 09:36 microsoftzhcn 阅读(4930) 评论(0) 推荐(0)
摘要:1、每年 2、每月 3、每日 实例:查询本月所有天数的微信支付统计 阅读全文
posted @ 2017-11-22 14:39 microsoftzhcn 阅读(2351) 评论(0) 推荐(0)
摘要:数据库中字段类型对应C#中的数据类型: 数据库 C#程序 int int32 text string bigint int64 binary System.Byte[] bit Boolean char string datetime System.DateTime decimal System.D 阅读全文
posted @ 2016-04-20 17:52 microsoftzhcn 阅读(13457) 评论(0) 推荐(5)
摘要:using System;using System.Collections.Generic;using System.Data;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;namespace Project... 阅读全文
posted @ 2015-08-04 17:26 microsoftzhcn 阅读(613) 评论(0) 推荐(0)
摘要:思路:.net 创建临时表,然后用SqlBulkCopy把临时表一次性复制的真正的数据表中;代码如下:protected void Button1_Click(object sender, EventArgs e){ using (SqlConnection connection = new ... 阅读全文
posted @ 2015-07-01 13:10 microsoftzhcn 阅读(648) 评论(0) 推荐(0)
摘要:DataSet和DataTable的区别与联系1、简要说明二者关系在我们编写代码的时候从数据库里取出数据,填充到dataset里,再根据表的名字,实例化到DataTable中。●注意如下Ado.Net关系:Connection_____Command____DataAdapter____Datase... 阅读全文
posted @ 2015-06-05 14:26 microsoftzhcn 阅读(1883) 评论(0) 推荐(0)
摘要:例子: datediff(dd,add_time,getdate()) not between 0 and 7select count(*) from table where DATEDIFF ([second], '2004-09-18 00:00:18', '2004-09-18 00:00:1... 阅读全文
posted @ 2015-04-02 21:29 microsoftzhcn 阅读(14926) 评论(0) 推荐(0)
摘要:因为id可能不是连续的,所以不能用取得10<id<20的记录的方法。有三种方法可以实现:一、搜索前20条记录,指定不包括前10条语句:select top 20 * from tbl where id not in (select top 10 id from tbl)二、搜索记录生成临时表,建立临... 阅读全文
posted @ 2014-11-26 11:37 microsoftzhcn 阅读(1440) 评论(0) 推荐(0)
摘要:一、html代码最近浏览记录asp.net处理代码private void get_history_log(HttpContext context) { string id = DTRequest.GetFormString("id_arr"); ... 阅读全文
posted @ 2014-11-04 17:32 microsoftzhcn 阅读(1042) 评论(0) 推荐(0)
摘要:(1).select * into destTbl from srcTbl(2).insert into destTbl(fld1, fld2) select fld1, 5 from srcTbl 阅读全文
posted @ 2014-06-19 16:15 microsoftzhcn 阅读(720) 评论(0) 推荐(0)
摘要:(Convert.ToDouble(num1)/Convert.ToDouble(num2)).ToString("0.00");.只要求保留N位不四舍5入 float f = 0.55555f; int i =(int)(f * 100); f = (float)(i*1.0)/100;2.保留N... 阅读全文
posted @ 2014-06-14 18:28 microsoftzhcn 阅读(1543) 评论(0) 推荐(0)
摘要:--如果两表结构一样。insertintotb1 select*fromtb2--也可以尝试从excel或access或TXT等文件导入。参考如下:导入导出大全导出到excelEXEC master..xp_cmdshell 'bcp SettleDB.dbo.shanghu out c:\temp... 阅读全文
posted @ 2014-05-06 09:24 microsoftzhcn 阅读(55088) 评论(0) 推荐(0)
摘要:一,ExpandoObject使用场合在传递对象,但是又不想创建一个class或者struct的时候,ExpandoObject就是一个非常好的选择。假如我们有一个SendMail的函数,功能是发送一个通知邮件给客户,邮件的文本模板,如下:Dear [Name],We have sent the gift to your address: [Address]在具体发送邮件的时候, [Name]和[Address]的内容是从函数GetMailParameters()动态读取出来的。那么函数GetMailParameters的返回值如何定义好呢?如果为GetMailParameters()函数创建 阅读全文
posted @ 2014-01-23 11:56 microsoftzhcn 阅读(1046) 评论(0) 推荐(0)
摘要:查询语句只要这样写,就可以随机取出记录了SQL="Select top 6 * from Dv_bbs1 where isbest = 1 and layer = 1 order by newID() desc"在ACCESS里SELECT top 15 id FROM tablename order by rnd(id)SQL Server:Select TOP N * From TABLE Order By NewID()Access:Select TOP N * From TABLE Order By Rnd(ID)Rnd(ID) 其中的ID是自动编号字段,可以利用其 阅读全文
posted @ 2013-11-04 17:51 microsoftzhcn 阅读(399) 评论(0) 推荐(0)