为什么数据不会来打印screen.error来到位置0没有行。但是有数据存在。星标线。 [英] why datas are not come to print screen.error comes There is no row at position 0.but there is data present.on star mark line.

查看:91
本文介绍了为什么数据不会来打印screen.error来到位置0没有行。但是有数据存在。星标线。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

**需要数据**

使用System;

使用System.Collections.Generic;

使用System.Web;

使用System.Web.UI;

使用System.Web.UI.WebControls;

使用System.Data.SqlClient;



公共部分类user_user_appoinment:System.Web.UI.Page

{

Class1 ob = new Class1();

私有字符串性别;

protected void Page_Load(object sender,EventArgs e)

{

if(!IsPostBack) )

{

grdv();

binddept();

bind_docnm();

bindcountry();

// clear();



}

}



public void grdv()

{

ob.grdv(select * from patient_reg order by pno, GridView1);

}

static int id;

publ ic int autoid()

{

ob.fetch(通过pno从patient_reg中选择pno);

if(ob.ds .Tables [0] .Rows.Count == 0)

{

id = 1;

返回id;

}

id = Convert.ToInt32(ob.ds.Tables [0] .Rows [ob.ds.Tables [0] .Rows.Count - 1] .ItemArray [0]。 ToString())+ 1;

返回id;

}

void clear()

{

bind_state();

txtpno.Text = autoid()。ToString();

txtbxName.Text =;

TextBoxAge.Text =;

TextBoxPatientQuery.Text =;

txtadr.Text =;



}

public void binddept()

{

ob.fetch(select * from doctor_details order by drdeptname);

drpdept.Items.Clear();

drpdept.DataSource = ob.ds.Tables [0];

drpdept.DataTextField =drdeptname;

drpdept.DataBind();

drpdept.Items.Insert(0,select);

}

public void bind_docnm()

{

ob.fetch(select drname from doctor_details drdeptname ='+ drpdept.SelectedItem.Text +');

drpdn.Items.Clear();

drpdn.DataSource = ob.ds.Tables [0];

drpdn.DataTextField =drname;

drpdn.DataBind();

drpdn.Items.Insert(0,select);

}

protected void drpdept_SelectedIndexChanged(object sender,EventArgs e)

{

bind_docnm();

}



public void bindcountry()

{

ob.fetch(select * from admin_country order by countryid);

drpcountry.Items.Clear();

drpcountry.DataSource = ob.ds.Tables [0];

drpcountry.DataTextField =countryname;

drpcountry.DataBind();

drpcountry.Items.Insert(0,select);

}

protected void btnsubmit_Click(object sender,EventArgs e)

{

if(txtpno.Text.Trim()==)

{

lblmsg.Text =病人否不应该空白;

txtpno.Focus();

return;

}

if(txtbxName。 Text.Trim()==)

{

lblmsg.Text =名称不应为空白;

txtbxName.Focus( );

如果(Radiom.Checked == true)

{

性别= Radiom.Text;

}

其他

{

性别= Radiof.Text;

}

if(TextBoxAge.Text.Trim()==)

{

lblmsg。 Text =选择性别;

TextBoxAge.Focus();

返回;

}

if( TextBoxPatientQuery.Text.Trim()==)

{

lblmsg.Text =查询不应为空白;

TextBoxPatientQuery .Focus();

返回;

}

if(drpdept.SelectedIndex == 0)

{

lblmsg.Text =必须选择部门;

drpdept.Focus();

返回;

}

if(drpdn.SelectedIndex == 0)

{

lblmsg.Text =必须选择医生;

drpdn.Focus();

return;

}

if(txtadr.Text.Trim()== )

{

lblmsg.Text =地址不应为空白;

txtadr.Focus();

返回;

}

if(drpcountry.SelectedIndex == 0)

{

lblmsg.Text =国家名称最多被选中;

drpcountry.Focus();

返回;

}

if(drpstate.SelectedIndex == 0)

{

lblmsg.Text =最多选择州名;

drpstate.Focus( );

返回;

}

if(drpcity.SelectedIndex == 0)

{

lblmsg.Text =最多选择州名;

drpcity.Focus();

返回;

}

ob.fetch(从patient_reg中选择pno,其中pno ='+ txtpno.Text +');

if(ob.ds.表[0] .Rows.Count> 0)

{

lblmsg.Text =已经存在;

txtbxName.Text =;

txtbxName.Focus();

会话[pno] = txtpno.Text;

返回;

}

其他

{



if(ob.dml_statment(插入patient_reg值('+ txtpno.Text.Trim( )+','+ txtbxName.Text.Trim()+','+ Gender +','+ TextBoxAge.Text.Trim()+','+ TextBoxPatientQuery.Text.Trim( )+','+ drpdept.SelectedItem.ToString()+','+ drpdn.SelectedItem.ToString()+','+ txtadr.Text.Trim()+','+ drpcountry.SelectedItem.ToString()+','+ drpstate.SelectedItem.ToString()+','+ drpcity.SelectedItem.ToString()+'))> 0)

{

Response.Write(< script LANGUAGE ='JavaScript'> alert('数据提交成功')< /脚本>);

clear();



}

}

}

public void bind_state()

{

ob.fetch(select * from admin_state where country ='+ drpcountry.SelectedItem .Text +');

drpstate.Items.Clear();

drpstate.DataSource = ob.ds.Tables [0];

drpstate.DataTextField =statename;

drpstate.DataBind();

drpstate.Items.Insert(0,select);

}



protected void drpcountry_SelectedIndexChanged(object sender,EventArgs e)

{

bind_state( );

}

public void bind_city()

{

ob.fetch(select * from admin_city where state ='+ drpstate.SelectedItem.Text +');

drpcity.Items.Clear();

drpci ty.DataSource = ob.ds.Tables [0];

drpcity.DataTextField =cityname;

drpcity.DataBind();

drpcity.Items.Insert(0,select);

}

protected void drpstate_SelectedIndexChanged(object sender,EventArgs e)

{

bind_city();

}

protected void GridView1_SelectedIndexChanged(object sender,EventArgs e)

{

尝试

{

txtpno.Text = GridView1.Rows [GridView1.SelectedIndex] .Cells [0] .Text;

txtbxName.Text = GridView1.Rows [GridView1.SelectedIndex] .Cells [1] .Text;

if(GridView1.Rows [GridView1.SelectedIndex] .Cells [2] .Text ==男)

{

Radiom.Checked = true;

Radiof.Checked = false;

}

其他

{

Radiof.Checked = true;

Radiom.Checked = false;

}

TextBoxAge.Text = GridView1.Rows [GridView1.SelectedIndex]。 Cells [3] .Text;

TextBoxPatientQuery.Text = GridView1.Rows [GridView1.SelectedIndex] .Cells [4] .Text;

drpdept.Text = GridView1.Rows [GridView1.SelectedIndex] .Cells [5] .Text;

drpdn.Text = GridView1.Rows [GridView1.SelectedIndex] .Cells [6] .Text;

drpcountry .Text = GridView1.Rows [GridView1.SelectedIndex] .Cells [7] .Text;

drpstate.Text = GridView1.Rows [GridView1.SelectedIndex] .Cells [8] .Text;

drpcity.Text = GridView1.Rows [GridView1.SelectedIndex] .Cells [9] .Text;

Session [pno] = txtpno.Text;

}

catch(例外情况)

{

ex.GetType();

}

}



protected void GridView1_RowDeleting(object sender,GridViewDeleteEventArgs e)

{

if(ob.dml_statment(delete from patient_reg where pno ='+ GridView1.Rows [e.RowIndex] .Cells [0] .Text +')> 0)

{

lblmsg.Text =数据删除;

grdv();

clear( );

}

}



protected void btncancel_Click(object sender,EventArgs e)

{

clear();

drpcity.SelectedIndex = 0;

txtbxName.Focus();

}

}

**打印代码**

使用系统;

使用系统。 Collections.Generic;

使用System.Web;

使用System.Web.UI;

使用System.Web.UI.WebControls;

使用System.Data.SqlClient;

使用System.Web.UI.WebControls.WebParts;

使用System.Web.UI.HtmlControls;

使用System.IO;

使用System.Text;

使用System.Web.SessionState;



public partial class user_apointmentTicketPrint:System.Web.UI.Page

{

Class1 ob = new Clas s1();

protected void Page_Load(object sender,EventArgs e)

{

ob.conn();

string pno = Session [pno]。ToString();

ob.fetch(select * from patient_reg其中pname ='+ pno +');

******** lblpno.Text = ob.ds.Tables [0] .Rows [0] .ItemArray [0] .ToString();

lbldrname。 Text = ob.ds.Tables [0] .Rows [0] .ItemArray [7] .ToString();

lbldept.Text = ob.ds.Tables [0] .Rows [0] .ItemArray [6] .ToString();

lblpname.Text = ob.ds.Tables [0] .Rows [0] .ItemArray [1] .ToString();

lblage.Text = ob.ds.Tables [0] .Rows [0] .ItemArray [4] .ToString();

lblplace.Text = ob.ds.Tables [0] .Rows [0] .ItemArray [10] .ToString();

}



}

**need from data**
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

public partial class user_user_appoinment : System.Web.UI.Page
{
Class1 ob = new Class1();
private string Gender;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
grdv();
binddept();
bind_docnm();
bindcountry();
// clear();

}
}

public void grdv()
{
ob.grdv("select * from patient_reg order by pno", GridView1);
}
static int id;
public int autoid()
{
ob.fetch("select pno from patient_reg order by pno");
if (ob.ds.Tables[0].Rows.Count == 0)
{
id = 1;
return id;
}
id = Convert.ToInt32(ob.ds.Tables[0].Rows[ob.ds.Tables[0].Rows.Count - 1].ItemArray[0].ToString()) + 1;
return id;
}
void clear()
{
bind_state();
txtpno.Text = autoid().ToString();
txtbxName.Text = "";
TextBoxAge.Text = "";
TextBoxPatientQuery.Text = "";
txtadr.Text = "";

}
public void binddept()
{
ob.fetch("select * from doctor_details order by drdeptname");
drpdept.Items.Clear();
drpdept.DataSource = ob.ds.Tables[0];
drpdept.DataTextField = "drdeptname";
drpdept.DataBind();
drpdept.Items.Insert(0, "select");
}
public void bind_docnm()
{
ob.fetch("select drname from doctor_details where drdeptname='" + drpdept.SelectedItem.Text + "'");
drpdn.Items.Clear();
drpdn.DataSource = ob.ds.Tables[0];
drpdn.DataTextField = "drname";
drpdn.DataBind();
drpdn.Items.Insert(0, "select");
}
protected void drpdept_SelectedIndexChanged(object sender, EventArgs e)
{
bind_docnm();
}

public void bindcountry()
{
ob.fetch("select * from admin_country order by countryid");
drpcountry.Items.Clear();
drpcountry.DataSource = ob.ds.Tables[0];
drpcountry.DataTextField = "countryname";
drpcountry.DataBind();
drpcountry.Items.Insert(0, "select");
}
protected void btnsubmit_Click(object sender, EventArgs e)
{
if (txtpno.Text.Trim() == "")
{
lblmsg.Text = "patient no should not blank";
txtpno.Focus();
return;
}
if(txtbxName.Text.Trim()=="")
{
lblmsg.Text = "name should not blank";
txtbxName.Focus();
return;
}

if (Radiom.Checked == true)
{
Gender = Radiom.Text;
}
else
{
Gender = Radiof.Text;
}
if (TextBoxAge.Text.Trim() == "")
{
lblmsg.Text = "Select gender";
TextBoxAge.Focus();
return;
}
if (TextBoxPatientQuery.Text.Trim() == "")
{
lblmsg.Text = "Query should not be blank";
TextBoxPatientQuery.Focus();
return;
}
if (drpdept.SelectedIndex == 0)
{
lblmsg.Text = "Department must be selected";
drpdept.Focus();
return;
}
if (drpdn.SelectedIndex == 0)
{
lblmsg.Text = "Doctor must be selected";
drpdn.Focus();
return;
}
if (txtadr.Text.Trim() == "")
{
lblmsg.Text = "Address should not be blank";
txtadr.Focus();
return;
}
if (drpcountry.SelectedIndex == 0)
{
lblmsg.Text = "Country name most be selected";
drpcountry.Focus();
return;
}
if (drpstate.SelectedIndex == 0)
{
lblmsg.Text = "State name most be selected";
drpstate.Focus();
return;
}
if (drpcity.SelectedIndex == 0)
{
lblmsg.Text = "State name most be selected";
drpcity.Focus();
return;
}
ob.fetch("select pno from patient_reg where pno='" + txtpno.Text + "'");
if (ob.ds.Tables[0].Rows.Count > 0)
{
lblmsg.Text = "Already Exists";
txtbxName.Text = "";
txtbxName.Focus();
Session["pno"] = txtpno.Text;
return;
}
else
{

if (ob.dml_statment("insert into patient_reg values('"+ txtpno.Text.Trim()+"','" + txtbxName.Text.Trim() + "','" + Gender + "','" + TextBoxAge.Text.Trim() + "','" + TextBoxPatientQuery.Text.Trim() + "','" + drpdept.SelectedItem.ToString() + "','" + drpdn.SelectedItem.ToString() + "','" + txtadr.Text.Trim() + "','" + drpcountry.SelectedItem.ToString() + "', '" + drpstate.SelectedItem.ToString() + "','" + drpcity.SelectedItem.ToString() + "')") > 0)
{
Response.Write("<script LANGUAGE='JavaScript'>alert('Data Submitted Sucessfully')</script>");
clear();

}
}
}
public void bind_state()
{
ob.fetch("select * from admin_state where country='" + drpcountry.SelectedItem.Text + "'");
drpstate.Items.Clear();
drpstate.DataSource = ob.ds.Tables[0];
drpstate.DataTextField = "statename";
drpstate.DataBind();
drpstate.Items.Insert(0, "select");
}

protected void drpcountry_SelectedIndexChanged(object sender, EventArgs e)
{
bind_state();
}
public void bind_city()
{
ob.fetch("select * from admin_city where state='" + drpstate.SelectedItem.Text + "'");
drpcity.Items.Clear();
drpcity.DataSource = ob.ds.Tables[0];
drpcity.DataTextField = "cityname";
drpcity.DataBind();
drpcity.Items.Insert(0, "select");
}
protected void drpstate_SelectedIndexChanged(object sender, EventArgs e)
{
bind_city();
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
txtpno.Text = GridView1.Rows[GridView1.SelectedIndex].Cells[0].Text;
txtbxName.Text = GridView1.Rows[GridView1.SelectedIndex].Cells[1].Text;
if (GridView1.Rows[GridView1.SelectedIndex].Cells[2].Text == "Male")
{
Radiom.Checked = true;
Radiof.Checked = false;
}
else
{
Radiof.Checked = true;
Radiom.Checked = false;
}
TextBoxAge.Text = GridView1.Rows[GridView1.SelectedIndex].Cells[3].Text;
TextBoxPatientQuery.Text = GridView1.Rows[GridView1.SelectedIndex].Cells[4].Text;
drpdept.Text = GridView1.Rows[GridView1.SelectedIndex].Cells[5].Text;
drpdn.Text = GridView1.Rows[GridView1.SelectedIndex].Cells[6].Text;
drpcountry.Text = GridView1.Rows[GridView1.SelectedIndex].Cells[7].Text;
drpstate.Text = GridView1.Rows[GridView1.SelectedIndex].Cells[8].Text;
drpcity.Text = GridView1.Rows[GridView1.SelectedIndex].Cells[9].Text;
Session["pno"] = txtpno.Text;
}
catch(Exception ex)
{
ex.GetType();
}
}

protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
if (ob.dml_statment("delete from patient_reg where pno='" + GridView1.Rows[e.RowIndex].Cells[0].Text + "'") > 0)
{
lblmsg.Text = "Data deleted";
grdv();
clear();
}
}

protected void btncancel_Click(object sender, EventArgs e)
{
clear();
drpcity.SelectedIndex = 0;
txtbxName.Focus();
}
}
**code for print**
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
using System.Web.SessionState;

public partial class user_apointmentTicketPrint : System.Web.UI.Page
{
Class1 ob = new Class1();
protected void Page_Load(object sender, EventArgs e)
{
ob.conn();
string pno = Session["pno"].ToString();
ob.fetch("select * from patient_reg where pname='" + pno + "'");
******** lblpno.Text = ob.ds.Tables[0].Rows[0].ItemArray[0].ToString();
lbldrname.Text = ob.ds.Tables[0].Rows[0].ItemArray[7].ToString();
lbldept.Text = ob.ds.Tables[0].Rows[0].ItemArray[6].ToString();
lblpname.Text = ob.ds.Tables[0].Rows[0].ItemArray[1].ToString();
lblage.Text = ob.ds.Tables[0].Rows[0].ItemArray[4].ToString();
lblplace.Text = ob.ds.Tables[0].Rows[0].ItemArray[10].ToString();
}

}

推荐答案




请注释错误行并检查其他行,你得到数据o r不在标签中



Hi
pls comment error line and check other lines ,u get data or not in label

******** lblpno.Text = ob.ds.Tables[0].Rows[0].ItemArray[0].ToString();//Comment this line
lblpname.Text = ob.ds.Tables[0].Rows[0].ItemArray[1].ToString();//Here check what u get number or name
lbldrname.Text = ob.ds.Tables[0].Rows[0].ItemArray[7].ToString();
lbldept.Text = ob.ds.Tables[0].Rows[0].ItemArray[6].ToString();


这篇关于为什么数据不会来打印screen.error来到位置0没有行。但是有数据存在。星标线。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆