Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7714651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:11:05+00:00 2026-06-01T02:11:05+00:00

using Visual.Web.Developer.2010.Express; using SQL.Server.Management.Studio.2008.R2; What I’m ultimately trying to do is update a sql

  • 0
using Visual.Web.Developer.2010.Express;
using SQL.Server.Management.Studio.2008.R2;

What I’m ultimately trying to do is update a sql database..
I’m stuck at this step.. I’ve got my webpage to print the sqldatabase content into a div.. Right now, I’m trying to put some content into a textbox. But whenever I debug, it’s throwing me this error. The error I am getting
Stuck at this part, please shine some light on my situation.
Also.. Am I going the right way with this? Is there a more effective method of doing this? Opinions and links to good tutorials/walkthroughs would be appreciated too! Thanks in advance.

My html

<input runat="server" class="hexen" id="investigate1"/><br />
<input type="text" class="hexen" id="investigate2"/><br />
<input type="text" class="hexen" id="investigate3"/><br />
<input type="text" class="hexen" id="investigate4"/><br />
<input type="text" class="hexen" id="investigate5"/><br />
    <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />

My C#

using System;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;

namespace WebApplication1
{
    public partial class Default1 : System.Web.UI.Page
    {
        protected void SimpleRead(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection("Data Source=AZUES-336\\JDOESQLSERVER;Initial Catalog=Northwind;Integrated Security=SSPI");
            SqlDataReader rdr = null;

            try
            {

                conn.Open();


                SqlCommand cmd = new SqlCommand("select * from Customers", conn);

                rdr = cmd.ExecuteReader();


                if (rdr.Read())
                {
                    investigate1.Text = rdr.GetValue(0).ToString;//Presumably where the error is happening
                }
            }

            finally
            {
                if (rdr != null)
                { rdr.Close(); }

                if (conn != null)
                { conn.Close(); }
            }
        }
    }
}

@Seany84
Default.aspx

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="WebApplication1.Default1" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

<script type="text/javascript">
    $(document).ready(function () {

        $('.hexen').after('<span class="ui-state-default ui-corner-all ui-icon-disk ui-icon saveButton" title="Save" style="float:left"></span>')// ui icon

    .keypress(function () {$(this).next('.saveButton').show();}); //adds ui icon

     $('.ui-state-default').hover(
     function () {$(this).addClass('ui-state-hover');},
     function () {$(this).removeClass('ui-state-hover');}
     ); //ui icon hover

        $('.saveButton').click(function () {
            var id = $(this).prev().attr('id'); //used in the "data" attribute of the ajax call
            var value = $(this).prev().val(); //used in the "data" attribute of the ajax call

            $.ajax({
                type: "POST",
                url: "Default.aspx",
                data: "{Id: " + id + ", Value: " + value + "}",
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                success: function (data) {
                    console.log(data);
                }
            });
            $(this).hide();
        }); //runs ajax call and removes ui-icon after .saveButton is clicked

    }); //end .ready
</script> 

<input runat="server" class="hexen" id="investigate1"/><br />
<input type="text" class="hexen" id="investigate2"/><br />
<input type="text" class="hexen" id="investigate3"/><br />
<input type="text" class="hexen" id="investigate4"/><br />
<input type="text" class="hexen" id="investigate5"/><br />
    <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</asp:Content>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:11:07+00:00Added an answer on June 1, 2026 at 2:11 am

    You need to use an ASP server control instead of a standard HTML input.

    Replace,

    <input runat="server" class="hexen" id="investigate1"/>
    

    with

    <asp:TextBox ID="investigate1" runat="server" CssClass="hexen" />
    

    and try it then.

    Also, should the line:

    investigate1.Text = rdr.GetValue(0).ToString;
    

    be this instead:

    investigate1.Text = rdr.GetValue(0).ToString();
    

    http://www.asp.net have good tutorials for ASP.net web forms, MVC and web pages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

using Visual.Web.Developer.2010.Express; using SQL.Server.Management.Studio.2008.R2; Kinda new at C# here.. I got the first row
I'm using Visual Web Developer 2010 Express and SQL Server 2008 R2 Management Studio
using Visual.Web.Developer.2010.Express; using SQL.Server.Management.Studios.R2.Express; What I'm trying to do, is get a button to
I'm using Visual Web Developer 2010. I created a sql server connection to a
I'm building an ASP.net application using Visual Studio Web Developer 2010 Express and have
I created a new ASP.NET website using Visual Web Developer 2008 Express edition and
Hi all I've just started a new project using Visual Web Developer 2008 Express
I am using Microsoft Visual Web Developer 2008 Express. I've made an ASP.NET MVC
Using Visual Studio 2008 and built-in web server. In a Web Handler .ashx file
I am creating two tables in Visual Web Developer 2010 Express using the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.