using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlServerCe;namespace kuaidi
{
public partial class wuliu : Form
{
public wuliu()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
if (ordernb.Text == "")
{
MessageBox.Show("请输入订单号");
}
else
{
SqlCeConnection cn = new SqlCeConnection(@"Data Source=C:\Documents and Settings\Administrator\桌面\软件文档\kuaidi\kuaidi\kuaidi.sdf");
cn.Open();
string sql = "select * from order WHERE ordernb = '" + ordernb.Text.Trim() + "'";
SqlCeCommand cmd = new SqlCeCommand(sql, cn);
SqlCeDataReader Dr = cmd.ExecuteReader();//分析查询出错了..
while (Dr.Read())
{
Order.Text = Dr[0].ToString();
}
cn.Close();
}
} }
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlServerCe;namespace kuaidi
{
public partial class wuliu : Form
{
public wuliu()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
if (ordernb.Text == "")
{
MessageBox.Show("请输入订单号");
}
else
{
SqlCeConnection cn = new SqlCeConnection(@"Data Source=C:\Documents and Settings\Administrator\桌面\软件文档\kuaidi\kuaidi\kuaidi.sdf");
cn.Open();
string sql = "select * from order WHERE ordernb = '" + ordernb.Text.Trim() + "'";
SqlCeCommand cmd = new SqlCeCommand(sql, cn);
SqlCeDataReader Dr = cmd.ExecuteReader();//分析查询出错了..
while (Dr.Read())
{
Order.Text = Dr[0].ToString();
}
cn.Close();
}
} }
}
qlCeConnection conn = new SqlCeConnection();// Set some connection string properties e.g.:
//
conn.ConnectionString =
"Persist Security Info = False; Data Source = 'SalesData.sdf';" +
"Password = '<password>'; File Mode = 'shared read'; " +
"Max Database Size = 256; Max Buffer Size = 1024";conn.Open();// You can change the database while preserving
// the orignal connection options
//
conn.ChangeDatabase("SupportData.sdf");
其他的有odbc 你的连接字符串本身不会出错 因为你引用了system.data.sql
但是在open的时候是打不开oracle数据库的
在接受数据的时候 你可以申明一个dateset 来接受数据集 WINFORMD 的页面展示没有.NET的方便
可以用datagirdview来展示 当然也可以动态来展示 不过建议楼主一步一步来
分 来吧