datagirdview和listview,删改查sqlserver数据库的小结
//创建DBhelper数据库链接文件
private static string sqlcon = "server=.;database=myschool;uid=sa;pwd=sa";
public static SqlConnection connection = new SqlConnection(sqlcon);
============================================================
//首先是lv控件的列表显示 ,(listview)
// 清空当前lv表中内容
listview.Items.Clear();
string sql = "select * from question";
//引用DBhelper中的数据库链接
SqlCommand command = new SqlCommand(sql,DBhelper.connection);
//打开数据库,并用dr读取记录
DBhelper.connection.Open();
SqlDataReader dr = command.ExecuteReader();
while (dr.Read())
{
ListViewItem lvi = new ListViewItem(dr["Question"].ToString());
lvi.SubItems.AddRange(new string[] { dr["Answer"].ToString(), dr["Difficulty"].ToString(), dr["SubjectId"].ToString(), dr["OptionA"].ToString(), dr["OptionB"].ToString(), dr["OptionC"].ToString(), dr["OptionD"].ToString() });
相关文档:
现在一般常用的有以下2种方法:
1. select top @pagesize * from table1 where id not in (select top @pagesize*(@page-1) id from table1 order by id) order by id
2. select * from (select top @pagesize * from (select top @pagesize*@page * from table1 order by id) a order by id desc) b or ......
1.绝对值
S:select abs(-1) value
O:select abs(-1) value from dual
2.取整(大)
S:select ceiling(-1.001) value
O:select ceil(-1.001) value from dual
3.取整(小)
S:select floor(-1.001) value
O:select floor(-1.001) value from dual
4.取整(截取)
S:select cast(-1.002 as int) value
O:selec ......
每次打开SQLServer查询分析器后,在连接窗口里的SQLServer服务器选择下拉框和登录用户名输入框里都会留有历史登录的记录,有时候我们是不希望这样的,比如在一个非私有领地做了暂时的开发后,不想留下任何连接远程数据库的记录,如何删除呢?还是注册表,找到以下路径:
HKEY_CURRENT_USER\Software\Microsoft\Microsoft&n ......
In the latest installment of the SQL Server interview questions, we will outline questions suitable for a DBA interview to assess the candidates skills related to SQL Server system databases. In this tip, the questions are there to read, but the answers are intentionally hidden to really test your s ......
ojdbc14.jar与classes12.jar有什么区别??
最近用classes12.jar,hibernate3.1老是出问题?
我的oracle9.2.0.10!
在网上找,发现有人用ojdbc14.jar开发,没有用过呢?看oracle的readme.txt也没有看什么呢?
那位大哥知道说一下!十分感谢!
------------------------------------------------------------------------- ......