c# - 'Object' does not contain a definition for 'Rows' and no extension method 'Rows' accepting a first argument of type 'object' could be found -
'object' A definition 'rows' and any extension method 'rows' to accept a first argument The type 'object' can not be found that you are missing using an instruction or an assembly reference
code is given below?
public partial square Default3: System.Web.UI.Page {static SqlConnection con = new SqlConnection (@ "connectionString"); Protected Zero Page_Load (Object Sender, EventArgs e) {{ddlImg.DataSource = GetData ("EmpID, Select EmpName from Tbl_Emp") if (this.IsPostBack!); ddlImg.DataTextField = "EmpName"; ddlImg.DataValueField = "EmpID"; DdlImg.DataBind (); }} Private Object GetData (String Query) {DataTable dt = New DataTable (); String constr = ConfigurationManager.ConnectionStrings ["tbFiles2ConnectionString"]. connection string; Using (using SqlConnection Thief = New SqlConnection (Construction)) {{SqlCommand cmd = New SqlCommand (query)) {{SqlDataAdapter sda = New SqlDataAdapter ()) {cmd.CommandType = CommandType.Text; Cmd.Connection = con; Sda.SelectCommand = cmd; Sda.fill (dt); }} Return DT; }} Secure Zero Button 1_Click (Object Sender, EventArgs E) {SqlCommand CMD = New SqlCommand (); Con.Open (); Cmd.Connection = con; cmd.CommandText = ("Tbl_Emp (EmpID, EmpName, EmpPic) values (included in" + TextBox1.Text + "," + + TextBox2.Text + "," '+ FileUpload1 +' ') "); Cmd.ExecuteNonQuery (); Con.Close (); } Secure Zero Button 2_Click (Object Sender, EventArgs E) {string id = ddlImg.SelectedItem.Value; Image 1 Visual = ID! = "0"; if (! id = "0") {byte [] bytes = (byte []) GetData ("Select data from Tbl_Emp where Emp_ID =" + id) .owsows [0] ["data"]; // here error popup string base64String = Convert.ToBase64String (byte, 0, bytes lang); Image1.ImageUrl = "data: image / png; base64," + base64String; }}
change your
getdata () function signature < / P>
Private Datatable GetData (string query) {}
Comments
Post a Comment