无线点菜
仿龙脉
截图:
PDF文件:毕业设计文件下载
源代码文件:代码下载
==========================================
安装步骤:
一、安装步骤
假设全部安装在同一台计算机上,将本光盘全部文件复制到目标计算机上
1、安装sql2000
2、进入目录“SQL服务器”,安装sp4
3、进入目录“SQL服务器”,还原数据库yunfei
4、进入目录“IIS服务器\Microsoft SQL Server 2005 Mobile Edition”,安装Sqlce30setupcn.msi
5、进入目录“IIS服务器\Microsoft SQL Server 2005 Mobile Edition”,安装sql2kcnsp4.msi
6、(确认所在计算机已经安装了IIS)将目录“IIS服务器\wwwroot”指定为IIS根目录
7、运行Microsoft SQL Server 2005 Mobile Edition的“配置 Web 同步向导”,
在出现的步骤中新建立虚拟目录sqlce,路径指定为“IIS服务器\wwwroot”,
客户端身份验证选择“以匿名方式”,
在“匿名访问”界面取消复选框的选择
8、进入目录“测试机器(虚拟PDA端)”,安装netsvwrap(Virtual PC Network Driver).msi
9、进入目录“测试机器(虚拟PDA端)”,安装Windows Mobile 5.0 Pocket PC SDK.msi
10、进入目录“测试机器(虚拟PDA端)”,安装Windows Mobile 5.0 Emulator Images for Pocket PC – CHS.msi
11、进入控制面板——添加硬件——添加新的硬件设备——“安装我手动从列表选择的硬件(高级)”——网络适配器——Microsoft Loopback
Adapter
二、演示步骤
(1)客户端
1、禁用除Microsoft Loopback Adapter的其他网络连接,为Microsoft Loopback Adapter连接配置IP
2、进入C:\Program Files\Microsoft Device Emulator\1.0, 运行dvcemumanager.exe,右键选择“Pocket PC 2003 SE仿真程序”——连接
3、为打开的“Pocket PC 2003 SE仿真程序”配置IP地址和代理服务器地址,IP地址应和本地计算机同一网段,代理服务器地址为本地计算机的IP
4、打开“Pocket PC 2003 SE仿真程序”的“文件——配置——网络”,选择“启用NE2000 PCMCIA网络适配器并绑定到”,确定。
5、打开“Pocket PC 2003 SE仿真程序”浏览器,在地址栏输入本地计算机的IP地址,若配置无误,则会出现一个HTML页面,按顺序安装。
6、打开“Pocket PC 2003 SE仿真程序”——程序——资源管理器——Program Files——yunfei——运行程序
SQL服务器名:当前SQLserver所运行的实例的名称
SQL代理地址:当前计算机的IP地址(即运行IIS服务的计算机地址)
默认用户名:haijun,密码:haijun
(2)管理端
进入目录“管理端”,安装,即可使用
首先配置网络,默认用户名:111,密码:111
========================================================================
基本代码:
using System;
using System.Text;
using System.IO;
using System.Data;
using System.Windows.Forms;
using System.Collections;
using System.Data.Common;
using System.Data.SqlServerCe;
using System.Data.SqlClient;
using System.Reflection;
namespace Yunfei_Client
{
public class SQLServerCEWrapper
{
public static string ceUser =null;// "haijun";
public static string SqlServer =null;// "HAIJUN";
public static string SqlAgent_ip = null;//192.168.0.254
public static string SqlAgent =null;
public static string RemoteConnection = "Provider=sqloledb;Data Source=" + SqlServer + ";Initial Catalog=yunfei;User ID=sa;Password=sa;";
public static string LocalDatabase = string.Format(@"{0}\yunfei.sdf", Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase));
public static string LocalConnection = string.Format(@"Data Source = {0}", LocalDatabase);
public SQLServerCEWrapper()
{
}
public bool CreateDatabase()
{
if (File.Exists(LocalDatabase))
{
File.Delete(LocalDatabase);
SqlCeEngine SQLCEEngine = new SqlCeEngine(LocalConnection);
SQLCEEngine.CreateDatabase();
SQLCEEngine.Dispose();
// MessageBox.Show("数据库创建成功!");
return true;
}
else
{
SqlCeEngine SQLCEEngine = new SqlCeEngine(LocalConnection);
SQLCEEngine.CreateDatabase();
SQLCEEngine.Dispose();
return true;
}
}
public void DeleteDatabase()
{
// Delete the local database!
// *****************************
try
{
if (File.Exists(LocalDatabase) == true)
{
File.Delete(LocalDatabase);
}
}
catch (SqlCeException ex)
{
ShowErrors(ex);
}
}
public void Pull(bool KeepLocalData, string TableName, string sqlSelectString)
{
// 将表请求下载到本地数据库中。
// *****************************
try
{
string SQL=null;
SqlCeConnection cn=null;
SqlCeCommand cmd=null;
SqlCeRemoteDataAccess RDA = null;
// 创建并启动新的 RDA 对象
RDA = new SqlCeRemoteDataAccess(SqlAgent, LocalConnection);
// 是否保留本地数据?如果要保留,请先强制上载这些数据!
if (KeepLocalData)
{
RDA.Push(TableName, RemoteConnection, RdaBatchOption.BatchingOff);
}
// 在 Pull 之前,必须先删除本地表
// 打开本地数据库连接
cn = new SqlCeConnection(LocalConnection);
cn.Open();
// 删除本地表
SQL = "DROP TABLE " + TableName;
cmd = new SqlCeCommand(SQL, cn);
// 如果该表不存在,则出错。
// 如果出错,可以置之不理。
try
{
cmd.ExecuteNonQuery();
}
catch
{
}
// 关闭连接
cmd.Dispose();
cn.Close();
cn.Dispose();
// 最后,请求下载远程表!
SQL = sqlSelectString;
RDA.Pull(TableName, SQL, RemoteConnection, RdaTrackOption.TrackingOnWithIndexes);
// 清理
SQL = null;
RDA.Dispose();
}
catch (SqlCeException ex)
{
ShowErrors(ex);
}
}
public void Push(string localTableName)
{
try
{
SqlCeRemoteDataAccess RDA = null;
// 创建并启动新的 RDA 对象
RDA = new SqlCeRemoteDataAccess(SqlAgent, LocalConnection);
RDA.Push(localTableName, RemoteConnection, RdaBatchOption.BatchingOff);
RDA.Dispose();
//MessageBox.Show("数据上传成功!");
}
catch (SqlCeException ex)
{
ShowErrors(ex);
}
}
public DataSet GetResult(string TableName, string sqlSelectString)
{
// 从本地数据库获取数据。作为 DataSet 返回。
// *****************************
//try
//{
string SQL=null;
SqlCeConnection cn=null;
SqlCeCommand cmd=null;
DataSet ds=null;
SqlCeDataAdapter da=null;
// 初始化新的连接
cn = new SqlCeConnection(LocalConnection);
// 打开连接
cn.Open();
// 生成 SQL
SQL = sqlSelectString;
// 初始化新的命令
cmd = new SqlCeCommand(SQL, cn);
// 初始化新的 DataSet
ds = new DataSet();
da = new SqlCeDataAdapter(SQL, cn);
// 通过适配器,使用数据来填充 DataSet
da.Fill(ds, TableName);
// 清理
da.Dispose();
cmd.Dispose();
cn.Close();
cn.Dispose();
SQL = null;
// 返回 DataSet
return ds;
//}
//catch (SqlCeException ex)
//{
// ShowErrors(ex);
//}
}
public int CountResult(string sqlCountString)
{
// Count the result.
// *****************************
//try
//{
int Count = 0;
string SQL=null;
SqlCeConnection cn=null;
SqlCeCommand cmd=null;
cn = new SqlCeConnection(LocalConnection);
cn.Open();
SQL = sqlCountString;
cmd = new SqlCeCommand(SQL, cn);
cmd.CommandText = SQL;
Count =(int)cmd.ExecuteScalar();
cmd.Dispose();
cn.Close();
cn.Dispose();
SQL = null;
return Count;
//}
//catch (SqlCeException ex)
//{
// ShowErrors(ex);
//}
}
//public void DoResult(string sqlInsertString)
//{
// try
// {
// string SQL;
// SqlCeConnection cn;
// SqlCeCommand cmd;
// cn = new SqlCeConnection(LocalConnection);
// cn.Open();
// SQL = sqlInsertString;
// cmd = new SqlCeCommand(SQL, cn);
// cmd.CommandText = SQL;
// int ccc=cmd.ExecuteNonQuery();
// cmd.Dispose();
// cn.Dispose();
// }
// catch (SqlCeException ex)
// {
// ShowErrors(ex);
// }
//}
public void Submit(string sqlString)
{
try
{
SqlCeRemoteDataAccess RDA = null;
// 创建并启动新的 RDA 对象
RDA = new SqlCeRemoteDataAccess(SqlAgent, LocalConnection);
RDA.SubmitSql(sqlString,RemoteConnection);
RDA.Dispose();
//MessageBox.Show(远程执行命令成功!");
}
catch (SqlCeException ex)
{
ShowErrors(ex);
}
}
public static void ShowErrors(SqlCeException e)
{
SqlCeErrorCollection errorCollection = e.Errors;
StringBuilder bld = new StringBuilder();
Exception inner = e.InnerException;
foreach (SqlCeError err in errorCollection)
{
bld.Append("\n Error Code: " + err.HResult.ToString("X", System.Globalization.CultureInfo.CurrentCulture));
bld.Append("\n Message : " + err.Message);
bld.Append("\n Minor Err.: " + err.NativeError);
bld.Append("\n Source : " + err.Source);
foreach (int numPar in err.NumericErrorParameters)
{
if (0 != numPar) bld.Append("\n Num. Par. : " + numPar);
}
foreach (string errPar in err.ErrorParameters)
{
if (String.Empty != errPar) bld.Append("\n Err. Par. : " + errPar);
}
}
MessageBox.Show(bld.ToString());
}
}
}