我在将数据导入到asp.net页面时遇到问题,当我打开页面时,我发现所有文件都为空

ow
 // this the code of the linked database with page 

        protected void Page_Load(object sender, EventArgs e)

    {

        if (String.IsNullOrEmpty(Request.QueryString["IDContent"]))

        {
            Response.Redirect("ContentList.aspx");
        }

        if (!String.IsNullOrEmpty(Request.QueryString["IDContent"]))
        {

            if (!IsPostBack)

//这是connectionString

            {
                SqlConnection Cn = new SqlConnection("Data Source = Lenovo;Initial Catalog = Web_Data; Integrated Security = True");
                Cn.Open();

                string Sql = "Select * From Content_Table Where IDContent = @IDContent";
                DataTable Dt = new DataTabel();
                SqlDataAdapter Da = new SqlDataAdapter(Sql, Cn);

                Da.SelectCommand.Parameters.AddWithValue("IDContent", Request.QueryString["IDContent"]);
                Da.Fill(Dt);
                Cn.Close();

//从Sql server导入数据的代码

                 if (Dt.Rows.Count > 0)

                {
                    TxtCategory2.SelectedValue = Dt.Rows[0]["FIDContent"].ToString();
                    TxtTitel2.Text = Dt.Rows[0]["ContentTitel"].ToString();
                    TxtDateTime2.Text = Dt.Rows[0]["ContentDateTime"].ToString();
                    TxtSummary2.Text = Dt.Rows[0]["ContentSummary"].ToString();
                    TextImage.Text = Dt.Rows[0]["ContentImage"].ToString();
                    TxtText2.Text = Dt.Rows[0]["ContentText"].ToString();

                    Image1.ImageUrl = TextImage.Text;

                }
                else
                {

                    LbMsg2.Text = " The Content is not exist!";
                }

                }

        }
    }
ow

我发现“ IDContent”的拼写有误,我将其更改为“ ContentID”,就像SQL Server表上的同名一样,这是可行的!,这只是键入erorr。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

当我使用`sequel`将数据从csv文件导入到postgresql中时出现错误

我如何将 Azure 构建管道数据导入到 Elasticsearch 的本地安装中

我应该如何使用pgAdmin 3将数据从CSV导入到Postgres表中?

我们可以将 BigQuery 中的数据导入到 Google Sheets 中吗?

我在将 Angular 应用程序部署到 github 页面时遇到问题

我在 php 中登录时遇到问题。当我在 localhost 中测试它时,登录页面工作正常。但是当我将它上传到服务器并进行测试时,它没有用

当我将所有元素放大到左侧时,我希望页面在放大时居中

我无法将Swift包导入到项目中

我无法将Excel导入到datagridview

将数据导入到mongodb时发生JSONParseException

当我发回到控制器时,我模型的所有值都为空

问题-将数据从mysql导入到HDFS

将数据从Word 2003(Doc)文件导入到Access?

将数据从.avro文件导入到配置单元表

使用sql将数据从文件csv导入到Oracle

将数据从CSV文件导入到InfluxDB

将数据从 csv 文件导入到 R

将数据从 xls 文件导入到 datagridview?

我可以将数据从本地 SQL Server 数据库导入到 Azure 机器学习虚拟机吗?

我们如何使用Azure Logic App将数据从Sharpoint上载的CSV文件导入到CRM实体中?

当我打开导航栏时,为什么所有页面都会移动?

我在设置wordpress联系人页面样式时遇到问题

将图像导入到 Django 页面

我在我的页面中的 php 日志中添加一个简单的记住我的功能时遇到问题?

当我将项目发布到服务器时,ASP.NET Core 没有默认页面

我在使用带有 Google 表格的 ImportJSON 导入数据时遇到问题

我在执行文件操作的脚本时遇到问题

我在 Python 中循环上传文件时遇到问题?

我在java中处理文件时遇到问题