关于数据库查询记录的问题 最简单的用 datagrid 每次显示一条记录 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 2. 用一个文本框记录你的当前记录的主键信息,用 sql 语句下一条: select * from tablename where clumnname > '" & textbox1.text & "'" order by clumnname asc上一条 select * from tablename where clumnname < '" & textbox1.text & "'" order by clumnname desc注意关键技术: > ------- asc < ------- descgood luck ! 哦,我不是说的很清楚了吗?sql="select * from tablename where clumnname > '" & textbox1.text & "'" order by clumnname asc"上一条和下一条关键就是 > 和 < 和 order by desc/asc 哦,呵呵呵,好吧,我在说一遍1 . datagrid 有分页功能吧,有上一页,下一页!2 . 如果你用的是 sql 数据库 在 查询分析器里用,关键是用 sql 语句实现 我上面的sql 语句 例如: 你的表 tb_user userid name 1 sdf sdf df df df dfff sdfuse sql 下一个 : select * from tb_user '用来显示所有数据 select * from tb_user where userid > 'df' order by userid asc '下一条 select * from tb_user where userid < 'df' order by userid desc '上一条 private void Last_Click(object sender, System.EventArgs e) { if (DS.Tables[0].Rows.Count>0) { CurrentRow--; if (CurrentRow<0) { CurrentRow=0; } Display_Record(CurrentRow); RecordNumber.Text="CurrentRow is " + (CurrentRow+1).ToString()+", Total is "+DS.Tables[0].Rows.Count.ToString(); } } //Move record to next private void Next_Click(object sender, System.EventArgs e) { if (DS.Tables[0].Rows.Count>0) { CurrentRow++; if (CurrentRow>DS.Tables[0].Rows.Count -1) { CurrentRow=DS.Tables[0].Rows.Count -1; } Display_Record(CurrentRow); RecordNumber.Text="CurrentRow is " + (CurrentRow+1).ToString()+", Total is "+DS.Tables[0].Rows.Count.ToString(); } } private void Display_Record(int CurrentRow) { DS.Tables[0].Clear(); oleDbDataAdapter1.Fill(DS,"employee"); DataView dv_employee = new DataView(DS.Tables[0],"employeeid='"+DS.Tables[0].Rows[CurrentRow][0].ToString()+"'","",DataViewRowState.CurrentRows); try { if (CurrentRow>=0 && CurrentRow<=DS.Tables[0].Rows.Count -1) { EmployeeID.Text=dv_employee.Table.Rows[CurrentRow][0].ToString(); FirstName.Text=dv_employee.Table.Rows[CurrentRow][1].ToString(); LastName.Text=dv_employee.Table.Rows[CurrentRow][2].ToString(); Title.Text=dv_employee.Table.Rows[CurrentRow][3].ToString(); Extension.Text=dv_employee.Table.Rows[CurrentRow][4].ToString(); Mobilephone.Text=dv_employee.Table.Rows[CurrentRow][5].ToString(); officelocation.Text=dv_employee.Table.Rows[CurrentRow][6].ToString(); Birthday.Text=Convert.ToString(dv_employee.Table.Rows[CurrentRow][7].ToString()); sittinglocation.Text=dv_employee.Table.Rows[CurrentRow][8].ToString(); if (dv_employee.Table.Rows[CurrentRow][9] != null && dv_employee.Table.Rows[CurrentRow][9] != DBNull.Value) { byte[] p_stream = (byte[])dv_employee.Table.Rows[CurrentRow][9]; Stream st = new MemoryStream(p_stream); picture.Image=Image.FromStream(st); st.Close(); } else { picture.Image=null; } picture.Refresh(); comboBox1.SelectedValue=dv_employee.Table.Rows[CurrentRow][10].ToString(); RecordNumber.Text="CurrentRow is " + Convert.ToString(CurrentRow+1) + ", Total is "+DS.Tables[0].Rows.Count.ToString(); } else { RecordNumber.Text="No Record!"; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } winform的,webform也差不多,除了图像,好像没有什么要改的。 no so difficulthttp://www.c-sharpcorner.com/Code/2003/July/NavigationSystemInASPNet.asp 各位大哥,能不能帮我到这儿再看一下,马上结贴。http://community.csdn.net/Expert/topic/3077/3077338.xml?temp=.2317011 能帮我到这儿看一下吗?http://community.csdn.net/Expert/topic/3077/3077338.xml?temp=.2317011 能帮我到这儿看一下吗?http://community.csdn.net/Expert/topic/3077/3077338.xml?temp=.2317011 配置win03服务器,用的asp.net,一直出现您无权查看该网页的错误 同样的代码出现不同的效果,你知道怎么回事吗? 关于从treeview节点取数的问题. 如何按主次显示这些无限级的数据啊?? 用asp数据库建关联命令!!在线等 小问题,急求~~~请大家帮帮忙!! 怎么在DataGrid中新增空白行? 谁有水晶报表+vs2002的中文开发指南教程,注意水晶报表是单独安装的,不是vs里捆绑的! 嵌入视频问题 !!!如何将Word文件在IE中打开 !!! 100分求救! 求ASP.Net论坛UBB代码的实现
下一条:
select * from tablename where clumnname > '" & textbox1.text & "'" order by clumnname asc
上一条
select * from tablename where clumnname < '" & textbox1.text & "'" order by clumnname desc注意关键技术: > ------- asc
< ------- descgood luck !
sql="select * from tablename where clumnname > '" & textbox1.text & "'" order by clumnname asc"
上一条和下一条关键就是 > 和 < 和 order by desc/asc
1 . datagrid 有分页功能吧,有上一页,下一页!
2 . 如果你用的是 sql 数据库 在 查询分析器里用,关键是用 sql 语句实现
我上面的sql 语句
例如: 你的表 tb_user
userid name
1 sdf
sdf df
df df
dfff sdfuse sql
下一个 :
select * from tb_user '用来显示所有数据
select * from tb_user where userid > 'df' order by userid asc '下一条
select * from tb_user where userid < 'df' order by userid desc '上一条
{
if (DS.Tables[0].Rows.Count>0)
{
CurrentRow--;
if (CurrentRow<0)
{
CurrentRow=0;
}
Display_Record(CurrentRow);
RecordNumber.Text="CurrentRow is " + (CurrentRow+1).ToString()+", Total is "+DS.Tables[0].Rows.Count.ToString();
} }
//Move record to next
private void Next_Click(object sender, System.EventArgs e)
{
if (DS.Tables[0].Rows.Count>0)
{
CurrentRow++;
if (CurrentRow>DS.Tables[0].Rows.Count -1)
{
CurrentRow=DS.Tables[0].Rows.Count -1;
}
Display_Record(CurrentRow);
RecordNumber.Text="CurrentRow is " + (CurrentRow+1).ToString()+", Total is "+DS.Tables[0].Rows.Count.ToString();
}
}
private void Display_Record(int CurrentRow)
{
DS.Tables[0].Clear();
oleDbDataAdapter1.Fill(DS,"employee");
DataView dv_employee = new DataView(DS.Tables[0],"employeeid='"+DS.Tables[0].Rows[CurrentRow][0].ToString()+"'","",DataViewRowState.CurrentRows);
try
{
if (CurrentRow>=0 && CurrentRow<=DS.Tables[0].Rows.Count -1)
{
EmployeeID.Text=dv_employee.Table.Rows[CurrentRow][0].ToString();
FirstName.Text=dv_employee.Table.Rows[CurrentRow][1].ToString();
LastName.Text=dv_employee.Table.Rows[CurrentRow][2].ToString();
Title.Text=dv_employee.Table.Rows[CurrentRow][3].ToString();
Extension.Text=dv_employee.Table.Rows[CurrentRow][4].ToString();
Mobilephone.Text=dv_employee.Table.Rows[CurrentRow][5].ToString();
officelocation.Text=dv_employee.Table.Rows[CurrentRow][6].ToString();
Birthday.Text=Convert.ToString(dv_employee.Table.Rows[CurrentRow][7].ToString());
sittinglocation.Text=dv_employee.Table.Rows[CurrentRow][8].ToString(); if (dv_employee.Table.Rows[CurrentRow][9] != null && dv_employee.Table.Rows[CurrentRow][9] != DBNull.Value)
{
byte[] p_stream = (byte[])dv_employee.Table.Rows[CurrentRow][9];
Stream st = new MemoryStream(p_stream);
picture.Image=Image.FromStream(st);
st.Close();
}
else
{
picture.Image=null;
}
picture.Refresh(); comboBox1.SelectedValue=dv_employee.Table.Rows[CurrentRow][10].ToString();
RecordNumber.Text="CurrentRow is " + Convert.ToString(CurrentRow+1) + ", Total is "+DS.Tables[0].Rows.Count.ToString();
}
else
{
RecordNumber.Text="No Record!";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
http://community.csdn.net/Expert/topic/3077/3077338.xml?temp=.2317011
http://community.csdn.net/Expert/topic/3077/3077338.xml?temp=.2317011