小编use*_*628的帖子

带有if条件的SQL插入

即时通讯使用SQL SERVER 2008 R2我有表LV与结构ID(varchar),名称(varchar)和项目(int)

ID  Name Item
1   xxx  5
2   yyy  9
3   rrr  11
4   hhh  19
Run Code Online (Sandbox Code Playgroud)

我想插入表LV_TEMP具有相同的结构,但条件>当项> 9然后我必须除9

什么预期表LV_TEMP

ID   Name Item
1    xxx  5
2    yyy  9
31   rrr  9
32   rrr  2
41   hhh  9
42   hhh  9
43   hhh  1
Run Code Online (Sandbox Code Playgroud)

我怎么能在SQL上做到这一点,我在C#上使用运算符modulo(%)9

提前谢谢你

sql modulo sql-server-2008-r2

5
推荐指数
1
解决办法
135
查看次数

SqlDataReader 不工作 - 不读取数据

我有一个SqlDataReader,但它永远不会进入Read()

\n\n

当我调试它时,它通过了循环while(readerOne.Read())。即使有数据,它也不会进入这个循环。

\n\n
public static List<Pers_Synthese> Get_ListeSynthese_all(string codeClient, DateTime DateDeb, DateTime DateFin)\n{\n   try\n   {\n      using (var connectionWrapper = new Connexion())\n      {\n         var connectedConnection = connectionWrapper.GetConnected();\n\n         string sql_Syntax = Outils.LoadFileToString(Path.Combine(appDir, @"SQL\\Get_ListeSynthese_All.sql"));\n\n         SqlCommand comm_Command = new SqlCommand(sql_Syntax, connectionWrapper.conn);\n         comm_Command.Parameters.AddWithValue("@codeClioent", codeClient);\n         comm_Command.Parameters.AddWithValue("@DateDeb", DateDeb);\n         comm_Command.Parameters.AddWithValue("@DateFin", DateFin);\n\n         List<Pers_Synthese> oListSynthese = new List<Pers_Synthese>();\n\n         SqlDataReader readerOne = comm_Command.ExecuteReader();\n\n         while (readerOne.Read())\n         {\n            Pers_Synthese oSyntehse = new Pers_Synthese();\n            oSyntehse.CodeTrf = readerOne["CODE_TARIF"].ToString();\n            oSyntehse.NoLV = readerOne["NOID"].ToString();\n            oSyntehse.PrxUnitaire = readerOne["PRIX_UNITAIRE"].ToString();\n            oSyntehse.ZoneId = readerOne["LE_ZONE"].ToString();\n            oSyntehse.LeZone = …
Run Code Online (Sandbox Code Playgroud)

c# sql-server sqldatareader

5
推荐指数
1
解决办法
2万
查看次数

C#substring在中间

我有以下数据:

D:\toto\food\Cloture_49000ert1_10_01_2013.pdf
D:\toto\food\Cloture_856589_12_01_2013.pdf
D:\toto\food\Cloture_66rr5254_10_12_2012.pdf
Run Code Online (Sandbox Code Playgroud)

如何提取日期部分?例如:

D:\toto\food\Cloture_49000ert1_10_01_2013.pdf --> 10_01_2013
D:\toto\food\Cloture_856589_12_01_2013.pdf --> 12_01_2013
D:\toto\food\Cloture_66rr5254_10_12_2012.pdf --> 10_12_2012
Run Code Online (Sandbox Code Playgroud)

我的想法是使用LastIndexOf(".pdf") 然后倒数10个字符.

如何使用子串或其他方法解决这个问题?

c# string substring

4
推荐指数
1
解决办法
2万
查看次数

如何按创建日期列出文件

我有ASP.NET(C#)4.0.

我的代码是这样的:

public IEnumerable<string> GetFiles(string searchPatternExpression)
{
    string path = @"D:\xxx\";
    SearchOption searchOption = SearchOption.TopDirectoryOnly;
    Regex reSearchPattern = new Regex(searchPatternExpression);
    return Directory
        .EnumerateFiles(path, "*", searchOption)
        .Where(file => reSearchPattern.IsMatch(Path.GetFileName(file)))
        .OrderBy(file => file);
}
Run Code Online (Sandbox Code Playgroud)

如何按文件的创建日期订购?

c# directory asp.net-mvc file

2
推荐指数
1
解决办法
335
查看次数

如何不限制maxBufferSize和maxReceivedMessageSize

我有一个ASP.NET(C#)4.0 WCF应用程序。我收到消息错误:

错误:超出了传入邮件的最大邮件大小配额(65536)。要增加配额,请在适当的绑定元素上使用MaxReceivedMessageSize属性。

我已经增加到

maxBufferSize="2097152" maxBufferPoolSize="524288" maxReceivedMessageSize="2097152"
Run Code Online (Sandbox Code Playgroud)

它工作正常。但是,恐怕下次可能会再次超出配额。

我可以把这个maxBufferSizemaxReceivedMessageSize有没有限制?

提前谢谢你

c# wcf

1
推荐指数
2
解决办法
2万
查看次数