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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:09:40+00:00 2026-05-22T21:09:40+00:00

So I have a SQL express server database. I have an inventory file. I

  • 0

So I have a SQL express server database. I have an inventory file. I have one statement to insert new records, and another one to update count in all records. The first one works fine, however I can not get the count to update. I wrapped each of those statement in there own try, catch and it does not catch. I am pretty lost here.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication8
{
class Program
{
    static void Main(string[] args)
    {
        string[] lines = System.IO.File.ReadAllLines(@"C:\out\b.txt");
        //System.Console.WriteLine("Contents of writeLines2.txt =:");
        int i = 0;
        foreach (string line in lines)
        {



                string sellername, sku, date1, quantity1, date2, asin, date3, date4, FNSKU;
                char[] tabs = { '\t' };
                string[] words = line.Split(tabs);

                sku = words[0];
                FNSKU = words[1];
                asin = words[2];
                quantity1 = words[5];
                Console.WriteLine("\t" + line);
                inventoryBLL u = new inventoryBLL();
                try
                {
                    u.AddToDatabase(sku, DateTime.Now, Convert.ToInt16(0), DateTime.Now, 0, asin, DateTime.Now, DateTime.Now, FNSKU);

                }
                catch
                { }
                try
                {
                    u.UpdateDatabase(sku, quantity1);

                }
                catch
                { }

                foreach (string s in words)
                {
                    System.Console.WriteLine(s);
                }


            ++i;

        }

        // Keep the console window open in debug mode.
        Console.WriteLine("Press any key to exit.");
        System.Console.ReadKey();
    }
}
 }

Here is the bll

 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using ConsoleApplication8.DataSet1TableAdapters;

 namespace ConsoleApplication8
 {
[System.ComponentModel.DataObject]
class inventoryBLL
{
    private AmazonSKUsTableAdapter _skuAdapter = null;
    protected AmazonSKUsTableAdapter Adatper
    {
        get
        {
            if (_skuAdapter == null)
                _skuAdapter = new AmazonSKUsTableAdapter();

            return _skuAdapter;
        }
    }

    [System.ComponentModel.DataObjectMethodAttribute
        (System.ComponentModel.DataObjectMethodType.Insert, false)]
    public void AddToDatabase(string sku, DateTime date, int quantity, DateTime date1, int quantity1, string asin, DateTime date2, DateTime date3, string FNSKU)
    {
        Adatper.AddToDatabase("A1B7M9EQGNCLQA", sku, date, quantity, date1, quantity1, asin, date2, date3, FNSKU);

    }

            [System.ComponentModel.DataObjectMethodAttribute
        (System.ComponentModel.DataObjectMethodType.Update, false)]
    public void UpdateDatabase(string sku, string quality)
    {
        Adatper.UpdateQuery(Convert.ToInt16(quality), sku);
    }
}

 }

Here is the query:

 UPDATE       AmazonSKUs
 SET                TotalQty = @TotalQty
 WHERE        (MerchantSKU = @Original_MerchantSKU); 
  • 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-22T21:09:41+00:00Added an answer on May 22, 2026 at 9:09 pm

    Why don’t you try putting some output statements in your catch blocks. Odds are excellent that it’s reporting the error; but without acting on the caught items, you’re likely throwing away the issues it is reporting!

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

Sidebar

Related Questions

I have a Sql Server 2008 Express database file that's currently being used by
I have one SQL Server Express instance with a pretty normal well formed database.
I currently have a SQL Server (Express 2005) database to hold some transaction/metadata that
Assume that you have a running SQL Server Express instance named (local)\SQLEXPRESS. Its database
I have a database working in my local sql server 2005 express edition. I
I have a database (SQL server express 2008) which has a column that is
First a little introduction. We have an SQL Server Express 2008 database, which schema
I have a WinForms C# application using a MS SQL Server Express database. The
When I try to add a new Sql Server Database file to my Visual
I have created a simple database in SQL Server Express which consists of three

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.