English 中文(简体)
• 如何清除Error in asp.net
原标题:How to clear Error in asp.net

我设计了我的网页。 该网页运行,但价值没有储存在数据库中。

错误:

An Error Occured 与此同时 数据 Hdr_AccountType。

不存在物体类型系统的绘图。 Web.UI.WebControls。 列出已知的有管理的本地提供者。

protected void btnSave_Click(object sender, EventArgs e)
{
    Int32 st;
    int len = browser.PostedFile.ContentLength;
    byte[] pic = new byte[len];
    browser.PostedFile.InputStream.Read(pic, 0, len);

    SqlCommand Cmd = new SqlCommand();
    SqlConnection Cnn = new SqlConnection();
    string ConnectionString;
    ConnectionString = ConfigurationManager.ConnectionStrings["PhotostudioConnectionString"].ConnectionString;

    Cnn.ConnectionString = ConnectionString;
    if (Cnn.State != ConnectionState.Open)
        Cnn.Open();
    Cmd.Connection = Cnn;
    Cmd.CommandType = CommandType.StoredProcedure;
    Cmd.CommandText = "sproc_Ins_ManualPhotoSettingsDetails";
    Cmd.Parameters.Clear();
    // Cmd.Parameters.AddWithValue("@Id", txtBillNo.Text);
    Cmd.Parameters.AddWithValue("@Name", txtName.Text);
    Cmd.Parameters.AddWithValue("@Phoneno", txtPhoneno.Text);
    Cmd.Parameters.AddWithValue("@Startdate", rdpDate.SelectedDate); 
    Cmd.Parameters.AddWithValue("@Enddate", rdpDelivDate.SelectedDate);
    Cmd.Parameters.Add("@Systemurl", SqlDbType.Image).Value = pic;
    SqlParameter Src = new SqlParameter("@FilePath", SqlDbType.NVarChar, 450);
    Src.Value = browser.PostedFile.FileName;
    Cmd.Parameters.Add(Src);
    Cmd.Parameters.AddWithValue("@Work", TextBox1.Text);
    Cmd.Parameters.AddWithValue("@Size", cmbSize.SelectedItem);
    Cmd.Parameters.AddWithValue("@Rate", txtRate.Text);
    Cmd.Parameters.AddWithValue("@Noofcopies", txtNoofcopies.Text);
    Cmd.Parameters.AddWithValue("@Total", txtTotal.Text);
    Cmd.Parameters.AddWithValue("@Paidamount", txtPaid.Text);
    Cmd.Parameters.AddWithValue("@Balance", txtbal.Text);


    try
    {
        st = Convert.ToInt32(Cmd.ExecuteScalar());

    }
    catch (Exception ex)
    {            
        throw new ApplicationException("An Error Occured 与此同时 数据 Hdr_AccountType。" + ex.Message);
        lblError.Visible = true;
        lblError.Text = "An Error Occured While " + ex.Message.ToString();
        return;
    }
    Cmd.Dispose();
最佳回答

这并不是说......你需要看到你为什么要:

No mapping exists from object type System.Web.UI.WebControls.ListItem to a known managed provider native type.

我必须使用<代码>cmbSize.S selectedItem.Value而不是cmbSize.S selectedItem

这样,把数据库接入放在你的网页上就是一个非常坏的概念,你就应当为处理数据库部分建立一个类别。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签