mobile 连接sql sever问题

liuxj627 2009-11-22 11:51:03
string sql = "select count(ID) from Uerinfo where uername="+textBox1.Text;
string tablename = textBox1.Text;
string remoteDB = "UerMsg";
string user = "sa";
string pwd = "";
string remoteIP = "192.168.1.1";
string rdaOleDbConnectString = "Data Source=" + remoteIP + ";Initial Catalog=" + remoteDB + ";User Id=" + user + ";Password =" + pwd;
try
{
SqlConnection sqlcon = new SqlConnection(rdaOleDbConnectString);
sqlcon.Open();

SqlCommand com = new SqlCommand(sql, sqlcon);

if ((int)com.ExecuteScalar() > 0)
{
MessageBox.Show("用户存在");
}
sqlcon.Close();
}
catch (PlatformNotSupportedException pe)
{
MessageBox.Show(pe.ToString());
}
大家帮我看看 这个代码有问题吗?我是在ppc模拟器上直接连接数据库的····这样行不行
...全文
64 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
peterb 2009-11-22
  • 打赏
  • 举报
回复
那你实际使用的时候数据库需要外网IP, 不推荐一般使用Web Services
feishanm 2009-11-22
  • 打赏
  • 举报
回复
先在PC上试试是否能成功 

7,655

社区成员

发帖
与我相关
我的任务
社区描述
Windows Phone是微软发布的一款手机操作系统,它将微软旗下的Xbox LIVE游戏、Zune音乐与独特的视频体验整合至手机中。
社区管理员
  • Windows客户端开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧