我目前正在开发一个调用winform的aspx页面。当前的问题是将网页中的文本框变量通过ProcessStartInfo事件传递给winform文本框以检索图像。查看器来自供应商,但仅适用于winform环境,但其他信息来自CF页面,href和非功能性Web图像查看器。我在做什么?将aspx页面的QueryString ID传递给winform文本框
ASPX页面代码:
namespace ImageView
{
public partial class _Default : System.Web.UI.Page
{
protected void page Load(object sender, EventArgs e)
{
TextBox1.Text = Request.QueryString["DKT_ID"].ToString();
//TextBox2.Text = Request.QueryString["Name"].ToString();
//TextBox3.Text = Request.QueryString["Age"].ToString();
ProcessStartInfo psi = new ProcessStartInfo(@"C:\ImageViewer\ImageView.exe");
psi.WindowStyle = ProcessWindowStyle.Normal;
Process p = new Process();
p.EnableRaisingEvents = true;
p.Exited += new EventHandler(MyExited);
p.StartInfo = psi;
p.Start();
}
Winform的代码:
//SQL section for returning images
#region "Images Query"
ImageQuery = "SELECT isn AS isn ";
ImageQuery += "FROM bc_bcc_document (NOLOCK) ";
ImageQuery += "WHERE barcode_id = ? ";
DataTable Imagetable = new DataTable();
Imagetable.Columns.Add("ISN", typeof(Int32));
DataRow Imagerows;
//fills table with Images information
OdbcCommand comd = new OdbcCommand(ImageQuery);
string conne = "Dsn=XXXX; uid=XXXXX; pwd=XXXXXX";
using (OdbcConnection connected = new OdbcConnection(conne))
{
comd.Connection = connected;
connected.Open();
comd.Parameters.AddWithValue("barcode_id", txtBarcode.Text);
OdbcDataReader readar = comd.ExecuteReader();
while (readar.Read())
{
isn = Convert.ToInt32(readar["isn"].ToString().TrimEnd());
Imagerows = Imagetable.NewRow();
Imagerows["ISN"] = isn;
}
readar.Close();
有趣的问题,你不能把它作为参数传递吗? – JonE
@ Glitch100因此是我询问的原因。我从来没有这样做过,所以我有点失落,因为它是完成这项工作所需的最后部分。你能解释还是展示一个例子? – clerktech