毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> net技术 >> 正文

C#字符串转datatime出错

更新时间:2012-12-21:  来源:毕业论文

C#字符串转datatime出错
static void Main(string[] args)         {             int j = sqlQueryTable("Data Source=ZHANGL;Initial Catalog=db_GVM;Integrated Security=True", "2012/11/4 12:41:16", "2012/11/4 12:41:56");            Console.WriteLine(j);              Console.ReadKey();         }         public static int sqlQueryTable(string specConnection, String startdatetime, String enddatetime)         {             int i = 0;             try            {                using (SqlConnection conn = new SqlConnection(specConnection))                {                    string strCmd = "select count(*) from tb_PDU where datetime >= 'startdatetime' and datetime <= 'enddatetime' ";                    conn.Open();                    SqlCommand sqlCmd = new SqlCommand(strCmd, conn);                    i = Convert.ToInt32(sqlCmd.ExecuteScalar());                    conn.Close();                }            }             catch (Exception ex)            {                Console.WriteLine(ex.Message + ex.Source);            }             return i;        }

string strCmd = "select count(*) from tb_PDU where datetime >= 'startdatetime' and datetime <= 'enddatetime' ";
C#里能这样解析吗?
string strCmd = "select count(*) from tb_PDU where datetime >= '"+startdatetime+"' and datetime <= '"+enddatetime+"' ";

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。