如何检索... [重复的问题] [英] how to retrieve... [duplicate question]

查看:125
本文介绍了如何检索... [重复的问题]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码是

DataSet dd = new DataSet();
dd = dbe.getData(从销售中选择帐单日期,其中saledate =''0000-00-00''");
invdate = Convert.ToDateTime(dd.Tables [0] .Rows [0] [0] .ToString());

my code is

DataSet dd = new DataSet();
dd = dbe.getData("select billdate from sales where saledate=''0000-00-00''");
invdate = Convert.ToDateTime(dd.Tables[0].Rows[0][0].ToString());

推荐答案

请阅读SQL和C#书籍开始编程之前很少.如果不是书,万维网"有足够的学习材料.

您不需要设置类似"where saledate =" 0000-00-00""的内容-错误.

您可以在SQL查询中设置日期格式,例如:
Please read SQL and C# books a little before starting programming. If not books, ''World Wide Web'' had enough material for learning.

You don''t need to set something like "where saledate=''0000-00-00''" - Its incorrect.

You can either set the format of date in SQL query like:
SELECT CONVERT(VARCHAR(10), GETDATE(), 101) AS [MM/DD/YYYY]





使用以下方法检索值后,在C#代码中使用



OR

in the C# code after retriving the value by using:

Convert.ToDateTime(XYZDate).ToString("yyyy/dd/MM");


这篇关于如何检索... [重复的问题]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆