strsql="select cust_id,cust_name from vt_frmcust where punid=@str1";
跟一下这个语句在MYSQL中能否查询出数据

解决方案 »

  1.   

    可以查出
    SELECT * FROM vt_frmcust v where punid='E0B7C94BB4444B9BA99666F9025C7A11'查的的结果
    'E0B7C94BB4444B9BA99666F9025C7A11', '00001,0003'
      

  2.   

    while(msdr.Read())
    {TextBox1.Text=msdr[0];
    TextBox2.Text=msdr[1];
    }
    }
      

  3.   

    TextBox1.Text=msdr[0];
    TextBox2.Text=msdr[1];
    不行,编译不过去,无法将类型Object隐形转化成string,应该不是这个问题
      

  4.   

    我又加了两句 MySqlConnection myconn = new MySqlConnection(constr);
    MySqlCommand mycomm =new MySqlCommand(constr);
    strsql="select cust_id,cust_name from vt_frmcust where punid=@str1";
    mycomm.Parameters.Add("@str1",MySqlDbType.VarChar,32);
    mycomm.Parameters["@str1"].Value=Request["unid"];

    还是不行
    mysql参数要怎么写啊
      

  5.   

    MySqlConnection   myconn   =   new   MySqlConnection(constr);
    MySqlCommand   mycomm   =new   MySqlCommand(constr);
    strsql= "select   cust_id,cust_name   from   vt_frmcust   where   punid=?str1 ";
    mycomm.Parameters.Add( "?str1 ",MySqlDbType.VarChar,32);
    mycomm.Parameters[ "?str1 "].Value=Request[ "unid "]; 把“@”改成“?”,即可