Hi i'm doing a project in asp.net .I have to create a tab and by clicking that tab i have to fetch data from DB.I'm Able to create a TAB.But I'm not able to fetch data from DB if i click on TAB.I'm posting my code ,if there is any modifications pls help me out.
This is my WebForm1.aspx.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Link1.WebForm1" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
This is my WebForm1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using MySql.Data.MySqlClient;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using MySql.Data.MySqlClient;
namespace Link1
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataBind();
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataBind();
}
protected void Button_click(object sender, EventArgs e)
{
MySqlConnection con = new MySqlConnection("server=localhost;user id=root;database=perfautomationdb;password=Password@1");
con.Open();
MySqlCommand cmd = new MySqlCommand("SELECT * FROM tfsperfqueue", con);
MySqlDataAdapter adp = new MySqlDataAdapter(cmd);
DataSet ds = new DataSet();
adp.Fill(ds);
cmd.ExecuteNonQuery();
GridView1.DataSource = ds;
GridView1.DataBind();
{
MySqlConnection con = new MySqlConnection("server=localhost;user id=root;database=perfautomationdb;password=Password@1");
con.Open();
MySqlCommand cmd = new MySqlCommand("SELECT * FROM tfsperfqueue", con);
MySqlDataAdapter adp = new MySqlDataAdapter(cmd);
DataSet ds = new DataSet();
adp.Fill(ds);
cmd.ExecuteNonQuery();
GridView1.DataSource = ds;
GridView1.DataBind();
}
}
}
}
}
2 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Harish SupekarPosted Jul 14, 2017, 4:42 AM
Harsha EadaraPosted Jul 17, 2017, 2:49 AM