hi...
i m also getting the error "Cannot perform '=' operation on System.String and System.Int32."
can u plz tell me what could be the reason for this how to solve this.
the datatype of column
patientid ------bigint
forename--------varchar(35)
salutation------varchar(35)
what i m trying to do in page_load is like this.
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindGrid();
}
}
public void BindGrid()
{
try
{
string ConnectionString = ConfigurationManager.ConnectionStrings["xxx"].ConnectionString;
SqlConnection myCon = new SqlConnection(ConnectionString);
myCon.Open();
SqlCommand myCmd = (SqlCommand)myCon.CreateCommand();
myCmd.CommandType = CommandType.Text;
string strsql = "Select patientid,forename,salutation from TableA";
myCmd.CommandText = strsql;
SqlDataAdapter da = new SqlDataAdapter(myCmd);
DataSet ds = new DataSet();
da.Fill(ds, "MyTable");
GridView1.DataSource = ds;
GridView1.DataBind();
}
catch (Exception ex)
{
string strException = ex.Message.ToString();
}
}
in aspx page:
forecolor="Khaki" font-bold="True" />
Width="71px">
<%--
DataSource='<%# BindSalutation() %>' DataTextField="SalutationType" DataValueField="SalutationType" SelectedValue='<%# Bind("SalutationType") %>' >
--%>