http://www.cnblogs.com/mephisto/archive/2013/01/25/2876213.html
解决方案 »
- AddFlow流程图控件从VB升级到.Net C#
- 我想用 C# 写一个简单测试 执行速度的程式
- 这个用什么事件(关于DataGridView的)?
- web service 及windows form client编好后,在发布上的问题
- 有偿请人帮忙.关于c#模拟提交.
- 高分求教:在C#下面实现Telnet功能的方法!!!!!!!!!!!!!!!!!!!!
- ★★C#中调用Windows API的要点(转贴)
- DataGrid (winForm)自动换行问题。
- 历史遗留问题收集(2):请将你的没有解决但是还想解决的问题贴在这儿,请各路高手关注讨论啊。
- 求助:关于ado.net中连接问题????
- 咋么在C#winform窗体中把输入的数据存放的数据库
- 怎样设置checkedlistbox某一行的字体
入库: SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=table;Integrated Security=True");
con.Open();
SqlCommand cmd = new SqlCommand(string.Format("select Count(*) form table where 路径= '{0}'", textBox.Text), con);
if ((int)cmd.ExecuteScalar() > 0)
{
MessageBox.Show("数据已经存在", "提示");
}
else
{
string sql = "insert into table(路径) values('" + textBox.Text + "')";
cmd.CommandText = sql;
cmd.ExecuteNonQuery();
MessageBox.Show("成功添加");
}读取:tring queryString = select 路径 from table";
using (SqlConnection connection = new SqlConnection( connectionString))
{
SqlCommand command = new SqlCommand( queryString, connection);
connection.Open();
SqlDataReader reader = command.ExecuteReader();
try
{
while (reader.Read())
{
textbox1.Text=reader[0].ToString(); }
}
finally
{
}
}
}
player.URL = reader[0].ToString();