CE 在WinCE下的连接数据库?
请教在WinCE 下的连接SQL数据库为什么连接不上,请高手帮忙!(这个看似简单的问题困扰我几天了“晕”)代码如下:
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.
using System.Data.SqlClient;
SqlConnection conn = new SqlConnection("Persist Security Info=False;Server=.;User ID=sa;Password=sa;Initial Catalog=Services;");
try
{
SqlCommand cmd = new SqlCommand();
= "select Count(*) from s_bm";
cmd.Connection = conn;
conn.Open();
textBox1.Text = cmd.ExecuteScalar().ToString();
MessageBox.Show("连接成功!", "系统提示");
conn.Close();
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message.ToString());
}