I am trying to Edit a Sql Row with the values of my textboxes. This is what I have. Can someone point me in the right direction?

conn.Open();
SqlCommand command = new SqlCommand(sqlString,conn);
SqlDataReader myDataReader = command.ExecuteReader();

if(myDataReader.HasRows)
{
while (myDataReader.Read())
{

MarketName.Text=myDataReader["FileName"].ToString();
//HopName.Text=myDataReader["HopName"].ToString();
SiteA.Text=myDataReader["SiteAName"].ToString();
SiteB.Text=myDataReader["SiteBName"].ToString();
ASRA.Text=myDataReader["ASRa"].ToString();
ASRB.Text=myDataReader["ASRb"].ToString();
GElevationA.Text=myDataReader["GroundElevA"].ToString();
GElevationB.Text=myDataReader["GroundElevB"].ToString();


}
}

string fName=Request.QueryString["id"];
string connStr = (ConfigurationSettings.AppSettings["dsn_SQL"]);
SqlConnection conn = new SqlConnection(connStr);
string sqlString = "Edit MWSaveBerto SET FileName='"+
SiteA.Text+"' WHERE FileName='"+ fName +"'";
//label1.Text=sqlString;


conn.Open();
SqlCommand command = new SqlCommand(sqlString,conn);
//SqlDataReader myDataReader = command.ExecuteReader();

conn.Close();
}

Let see if this helps...

Try visiting http://www.w3schools.com/sql/default.asp

A very free site with good intro tutorial on SQL.

Saying that here is the issue:

string sqlString = "Edit MWSaveBerto SET FileName='"+
SiteA.Text+"' WHERE FileName='"+ fName +"'";

You are using Edit, which is not and SQL keyword, you should replace Edit with UPDATE.

Hope this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.