问题描述
- 这个问题应该如何解决?
-
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using HPCIMTS.PublicClass;namespace HPCIMTS_admin
{
public partial class frmPatienttracking : Form
{
BindingNavigator patientsBindingNavigator = new BindingNavigator();
BindingSource patientsBindingSource = new BindingSource();public frmPatienttracking() { InitializeComponent(); } private void frmPatienttracking_Load(object sender, EventArgs e) { string connectString = "Data Source=.;Initial Catalog=HPCIMTS;Integrated Security=SSPI"; SqlConnection connection = new SqlConnection(); connection.ConnectionString = connectString; connection.Open(); SqlCommand command = new SqlCommand("Select*From vw_病人查询", connection); SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection); DataSet ds = new DataSet("HPCIMTS vw_病人查询"); ds.Load(reader,LoadOption.OverwriteChanges,new string[] { "vw_病人查询" }); this.txt_Pno.DataBindings.Add(new Binding("Text",this.patientsBindingSource,"病案号",true)); } }
}
应该怎么改?
解决方案
在ds.Load(reader,LoadOption.OverwriteChanges,new string[] { "vw_病人查询" });下一个断点,
然后展开ds
展开里面的tables,看看有没有vw_病人查询
进一步展开,里面的Columns,里面有没有病案号
解决方案二:
你的问题是什么。贴出你的代码、异常信息或者你想做什么
时间: 2024-10-29 16:16:10