TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rizvi
NA
8
0
No mapping exists from object type System.Web.UI.WebControls.Label to a known managed provider native type. Please help!
Nov 28 2009 5:53 PM
I am using a data grid to access and update the data of table in database. I am getting this exception in the update event of the grid.
Please help me find the problem. Any help will be appriciated
feedbk is the dataGrid.
public partial class FeedBackForm : System.Web.UI.Page
{
string prefx; string cnum; string email; string SNo;
String myConnStr = null;
public void dataFillIn()
{
myConnStr = ConfigurationSettings.AppSettings["ConnectionString"];
SqlConnection myConn;
myConn = new SqlConnection(myConnStr);
SqlCommand myCommand = new SqlCommand("sp_CLOList", myConn);
myCommand.CommandType = CommandType.StoredProcedure;
myCommand.Parameters.AddWithValue("@Prefix", prefx);
myCommand.Parameters.AddWithValue("@Cno", cnum);
myCommand.Parameters.AddWithValue("@SecNO", SNo);
SqlDataAdapter da = new SqlDataAdapter(myCommand);
DataSet ds = new DataSet();
myConn.Open();
da.Fill(ds);
myCommand.ExecuteNonQuery();
feedbk.DataSource = ds;
DataBind();
myConn.Close();
}
protected void Page_Load(object sender, EventArgs e)
{
prefx = Request.QueryString["Prefix"];
cnum = Request.QueryString["Cnumber"];
email = Request.QueryString["Email"];
SNo = Request.QueryString["SecNo"];
this.prefix.Text = prefx;
this.Cno.Text = cnum;
this.sec.Text = SNo;
if (!this.Page.IsPostBack)
{
dataFillIn();
myConnStr = ConfigurationSettings.AppSettings["ConnectionString"];
SqlConnection myConn;
myConn = new SqlConnection(myConnStr);
SqlCommand cmd = new SqlCommand("sp_Feedback", myConn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Cno", cnum);
cmd.Parameters.AddWithValue("@Prefix", prefx);
cmd.Parameters.AddWithValue("@SecNo", SNo);
myConn.Open();
fb.Text = cmd.ExecuteScalar().ToString();
myConn.Close();
}
}
protected void feedbk_UpdateCommand(object source, DataGridCommandEventArgs e)
{
string clo = (string)feedbk.DataKeys[e.Item.ItemIndex];
string Rating = ((TextBox)e.Item.Cells[5].Controls[0]).Text;
string Criteria = ((TextBox)e.Item.Cells[6].Controls[0]).Text;
string Justification = ((TextBox)e.Item.Cells[7].Controls[0]).Text;
myConnStr = ConfigurationSettings.AppSettings["ConnectionString"];
SqlConnection myConn;
myConn = new SqlConnection(myConnStr);
SqlCommand cmd = new SqlCommand("sp_updateCLO", myConn);
cmd.CommandType = CommandType.StoredProcedure;
Decimal u = System.Convert.ToDecimal(Rating);
cmd.Parameters.AddWithValue("@rating", u);
cmd.Parameters.AddWithValue("@criteria", Criteria);
cmd.Parameters.AddWithValue("@justification", Justification);
cmd.Parameters.AddWithValue("@objective", clo);
cmd.Parameters.AddWithValue("@prefix", prefix);
cmd.Parameters.AddWithValue("@cnumber", cnum);
int i = System.Convert.ToInt32(SNo);
cmd.Parameters.AddWithValue("@snumber", i);
myConn.Open();
cmd.ExecuteNonQuery(); (
the exception occurs over here)
myConn.Close();
feedbk.EditItemIndex = -1;
dataFillIn();
}
the stored procedure is
USE [EvalDB]
GO
/****** Object: StoredProcedure [dbo].[sp_updateCLO] Script Date: 11/28/2009 16:52:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_updateCLO]
@prefix varchar(5), @cnumber varchar(25), @snumber int, @rating decimal(3,2),
@justification varchar(255),@criteria varchar(255),@objective varchar(255)
AS
Begin
Update SectionCLO set Rating=@rating,Justification=@justification,Criteria=@criteria where Objective=@objective
and CNumber=@cnumber and CPrefix = @prefix and SNumber =@snumber
end
Reply
Answers (
2
)
confusion in file uploading in asp.net with c#
player