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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:12:34+00:00 2026-05-26T07:12:34+00:00

I am connected to a SQL Server Compact Edition Database. One of the tables

  • 0

I am connected to a SQL Server Compact Edition Database. One of the tables involved has 3 columns – CompanyID, CompanyName and CompanyNotes. I have created a form in Visual Basic to add a new company to the database, and of course I don’t want the user to have to manually put in the company ID.

In the dataset.xsd I have created an INSERT SQL query that simply inserts a new row with the CompanyID, CompanyName and CompanyNotes. I have set the CompanyID to auto-increment. However, when I tried inserting the name and notes it didn’t like it because I set the ID field to be mandatory. How will I insert the new company data into a new row with a new ID?

The very basic code I currently use for adding a new company:

Private Sub btnSave_Click(sender As System.Object, e As System.EventArgs) Handles btnSave.Click
    Me.CompanyTableAdapter1.AddCompany(??????????, txtCompanyName.Text, txtCompanyNotes.Text)
    Me.Close()
End Sub

What should I put instead of the ‘?????’, or should I be doing something completely different?

Thanks!

  • 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-26T07:12:34+00:00Added an answer on May 26, 2026 at 7:12 am

    Simply omit the ID field in your SQL query.

    INSERT INTO company (CompanyName, CompanyNotes) VALUES (?, ?)
    

    Then your method can be simplified by removing the ID parameter:

    Me.CompanyTableAdapter1.AddCompany(txtCompanyName.Text, txtCompanyNotes.Text)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a database in SQL server Compact Edition. I tried to attach
I have an ASP .NET 2.0 website connected to a SQL Server 2005 database.
I have the following code to connect to a sql server compact edition 2008:
We have a Microsoft SQL Server 2005 database that needs to be converted back
In my organization, we have a SQL Server 2005 database server (DBServer). Users of
I try to use SQL Server Compact Edition with Entity Framework in Visual Studio
I have both 'SQL Server Compact 3.5 Service Pack 1' and 'SQL Server Management
I have two tables, one parent Point and one child PointValue, connected by a
I've been preparing to deliver a presentation on SQL Server Compact Edition 3.5 (SP1
I am using SQL Server Express 2005. I have a single database myDB I

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.