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

Ask A Question

Stats

  • Questions 203k
  • Answers 203k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use Session or hidden fields. This actually was answered on… May 12, 2026 at 8:35 pm
  • Editorial Team
    Editorial Team added an answer On stripping assert statements: this is a standard option in… May 12, 2026 at 8:35 pm
  • Editorial Team
    Editorial Team added an answer There is a slight conceptual error with your second argument… May 12, 2026 at 8:35 pm

Related Questions

up till now I have a linq query that fills a datagrid perfectly with
I been wondering about this for a while. It seems like there are so
I got this next problem. I have a binary file, which I write to
Hey guys, I'm writing a word wrap function to format console text in C++.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.