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

  • Home
  • SEARCH
  • 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 198441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:56:16+00:00 2026-05-11T16:56:16+00:00

I use this code till I see data in my database and edit,delet and

  • 0

I use this code till I see data in my database and edit,delet and insert data in that . but I want when I insert data to database , that is not REPETITIOUS , and if that is REPETITIOUS show me a message box about it.

Code :

private void btnok_Click(object sender, EventArgs e)
    {
        string id = idTextBox.Text.ToString();
        string name = nameTextBox.Text.ToString();
        string family = familyTextBox.Text.ToString();
        table1BindingSource.EndEdit();
        table1TableAdapter.Update(database1DataSet.Table1);

    }

    private void butins_Click(object sender, EventArgs e)
    {
        table1BindingSource.AddNew();
    }

    private void butdelete_Click(object sender, EventArgs e)
    {
        table1BindingSource.RemoveCurrent();
        table1TableAdapter.Update(database1DataSet.Table1);
    }

    private void butedit_Click(object sender, EventArgs e)
    {
        table1BindingSource.EndEdit();
        table1TableAdapter.Update(database1DataSet.Table1);
    }

I write this Query,but I dont know , how can I use that?
I write that in “Database1DataSet.xsd” , and appeared fillby() and gatedataby() in Tableadapter.

query :

SELECT     id, name, family
FROM         Table1
WHERE     (id = @id) AND (name = @name) AND (family = @family)
  • 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-05-11T16:56:16+00:00Added an answer on May 11, 2026 at 4:56 pm

    I’d suggest that you follow Marc’s answer.

    The exception you’ll catch is a SqlException with error number 2601, it may be something like this:

    catch(System.Data.SqlClient.SqlException lExSql)
    {
        if(lExSql.Number == 2601)
            return Result.Duplicate;
        else
            return Result.Failure;
    }
    catch
    {
        return Result.Failure;
    }
    

    Also a side note: there’s no need to call TextBox.Text.ToString(), because the Text property is a String itself.

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

Sidebar

Related Questions

Consider: print $foo, AAAAAAAA, $foo, BBBBBBBB; Let's say I want to use this code
i am trying to use this code to bind my asp.net menu control to
I often use this code pattern: while(true) { //do something if(<some condition>) { break;
I'm trying to use this code to replace spaces with _, it works for
If I wrote this code: typeof(myType).TypeHandle Would it use reflection? How much different from:
I'm looking at some GXT code for GWT and I ran across this use
What criteria should I use to decide whether I write VBA code like this:
In C# I use the #warning and #error directives, #warning This is dirty code...
I use this tool called Lazy C++ which breaks a single C++ .lzz file
I use this line in my .htaccess file to automatically add a trailing slash

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.