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 8119335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:46:32+00:00 2026-06-06T04:46:32+00:00

I’m going to edit textbox value.. but i saw there’s a problem protected void

  • 0

I’m going to edit textbox value.. but i saw there’s a problem

  protected void btn_edit_Click(object sender, EventArgs e)
    {
        DatabaseConnector con = new DatabaseConnector().CreateInstance();
        SqlCommand com = new SqlCommand("UPDATE tbl_BinCardManager SET ItemName = @ItemName WHERE ItemNo = @ItemNo");
        com.Parameters.Add("@ItemName",sqlDbType.VarChar);
        con.Open();
        cmd.ExecuteNonQuery();
        con.Close();

    }

ERROR 1:

The name ‘sqlDbType’ does not exist in the current context

ERROR 2:

‘ERPSystem.DatabaseConnector’ does not contain a definition for ‘Open’
and no extension method ‘Open’ accepting a first argument of type
‘ERPSystem.DatabaseConnector’ could be found (are you missing a using
directive or an assembly reference?)

My DBConnector Class is :

 class DatabaseConnector
{
    private DatabaseConnector databaseConnector;
    private string connectionString = "Data Source=lernlap;Initial Catalog=ERPSystemDB;User ID=sa;Password=sa123";

    public DatabaseConnector()
    {

    }

    private SqlConnection connection;

    private bool Connect()
    {
        try
        {
            connection = new SqlConnection(connectionString);
            connection.Open();
            return true;
        }
        catch(Exception) {

            return false;

        }
    }

    internal DatabaseConnector CreateInstance()
    {
        if (databaseConnector == null)
        {
            databaseConnector = new DatabaseConnector();
            databaseConnector.Connect();
        }
        return databaseConnector;
    }
  • 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-06T04:46:33+00:00Added an answer on June 6, 2026 at 4:46 am

    C# is case sensetive… Try using intellisense.

    SqlDbType
    

    The other errors may disappear if you correct the first one.


    On a side note, you’re going to run into connection/memory leaks without proper resource handling. Personally, I use the using statement to avoid the pitfalls.

    I’m not entirely certain what “DatabaseConnector” is, possible your own class, but you should probably be using SqlConnection instead, or possibly SqlDatabase.

    Update: I’m not sure if the DBConnector class is supposed to be a singleton or a factory, or both – so I just simplified my answer to avoid using it. Ask another question with detail on how to create the pattern you’re looking for and provide the DBConnector class. I think it’s do-able, but I just don’t have enough info to fix what you have.

    public static CONN_STR = "Data Source=lernlap;Initial Catalog=ERPSystemDB;User ID=sa;Password=sa123";
    
      protected void btn_edit_Click(object sender, EventArgs e) 
        { 
            using(SqlConnection con = new SqlConnection(CONN_STR))
            {
              con.Open(); 
    
              using(SqlCommand cmd = new SqlCommand("UPDATE tbl_BinCardManager SET ItemName = @ItemName WHERE ItemNo = @ItemNo"), con)
              {
    
                // TODO: fill in param values with real values
                cmd.Parameters.AddWithValue("@ItemName", "my item name");
                cmd.Parameters.AddWithValue("@ItemNo", 1);
    
                cmd.ExecuteNonQuery(); 
              }
            }
         }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I need to clean up various Word 'smart' characters in user input, including but
Seemingly simple, but I cannot find anything relevant on the web. What is the
i got an object with contents of html markup in it, for example: string
I am currently running into a problem where an element is coming back from

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.