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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:20:41+00:00 2026-05-21T07:20:41+00:00

Hi all i have my database structure as follows Field Type FileHeader longblob BatchHeader

  • 0

Hi all i have my database structure as follows

 Field        Type
FileHeader    longblob
BatchHeader   longblob
Entry         longblob
BtchEntry     longblob
FileControl   longblob

I will have the data to be inserted is as follows

101 111111111 1111111111104021031A094101                                                      
52201               1                   1         PPD1         110402110402   1111000020000001
6221110000251                00000000011              1                     1 0111000020000001
822000000100111000020000000000000000000000011                                  111000020000001
52251               1                   1         CCD1         110402110402   1111000020000002
6281110000251                00000000011              1                     1 0111000020000002
822500000100111000020000000000010000000000001                                  111000020000002
9000006000001000000060066600012000000000003000000000003                                    

as you can observe there are multiple lines that starts with 5,6 and 8. I would like to save those individually to the corresponding columns of my table. Is it possible to do if so can any mention the best method to do it. If unclear please specify

The code i written is

 using (StreamReader srRead = new StreamReader(filePath))
    {
        while (srRead.Peek() >= 0)
        {
            strLine = srRead.ReadLine();
            if (strLine.StartsWith("1"))
            {
                strFileHeader = strLine;
            }
            if (strLine.StartsWith("5"))
            {
                strBatchHeader = strLine;
            }
            if (strLine.StartsWith("6"))
            {
                strEntry = strLine;
            }
            if (strLine.StartsWith("8"))
            {
                strBtchcntrl = strLine;
            }
            if (strLine.StartsWith("9"))
            {
                strFileCntrl = strLine;
            }
        }

  string strQuery = "insert into tblfiles(FName, FData,FileHeader,BatchHeader,Entry,BtchEntry,FileControl) values (@_FName,@_FData,@_FileHeader,@_BtchHeader,@_EntryDets,@_BtchCntrl,@_FileCntrl)";
        MySqlCommand cmd = new MySqlCommand(strQuery);
        cmd.Parameters.Add("@_FName", MySqlDbType.VarChar).Value = filename;
        cmd.Parameters.Add("@_FData", MySqlDbType.LongBlob).Value = bytes;
        cmd.Parameters.Add("@_FileHeader", MySqlDbType.LongBlob).Value = strFileHeader;
        cmd.Parameters.Add("@_BtchHeader", MySqlDbType.LongBlob).Value = strBatchHeader;
        cmd.Parameters.Add("@_EntryDets", MySqlDbType.LongBlob).Value = strEntry;
        cmd.Parameters.Add("@_BtchCntrl", MySqlDbType.LongBlob).Value = strBtchcntrl;
        cmd.Parameters.Add("@_FileCntrl", MySqlDbType.LongBlob).Value = strFileCntrl;
        InsertUpdateData(cmd);

But this will insert the latest to the DB but i would like to save each and every line as per i stated

  • 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-21T07:20:42+00:00Added an answer on May 21, 2026 at 7:20 am

    No – a column can only store one value per row. You could combine all your batch headers into one blob and store that as a single value, but you would have to be able to split them apart again when your read the data.

    Instead – it looks as though:

    1. each file starts with a ‘1’ record and ends with a ‘9’ record
    2. each file contains zero or more batches
    3. each batch starts with a ‘5’ record and ends with an ‘8’ record
    4. each batch contains zero or more entries (‘6’ records)

    If that is all correct, then you need 3 tables that would look something like:

    File table:

    Field         Type
    -----------   --------
    FileID        integer   # unique file ID - see AUTO_INCREMENT in the MySQL reference
    FName         varchar
    FData         longblob
    FileHeader    longblob  # '1' record
    FileControl   longblob  # '9' record
    

    Batch table:

    Field         Type
    -----------   --------
    FileID        integer   # references a row in the File table
    BatchID       integer   # unique batch ID
    BatchHeader   longblob  # '5' record
    BatchControl  longblob  # '8' record
    

    BatchEntry table:

    Field         Type
    -----------   --------
    BatchID       integer   # references a row in the Batch table
    EntryId       integer   # unique file ID
    Entry         longblob  # '6' record
    

    That should get you started. Good luck.

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

Sidebar

Related Questions

I have a database that has lots of data and is all neat, normalized
I'm creating and app that will rely on a database, and I have all
I have a database with Points of Interest that all have an address. I
I have 3 database tables, all of them have the same 5 columns. They
Our database server is a SQL 2008 server. My colleagues all have XP service
We have a database in which all the PKs are GUIDs, and most of
I have a database table called Posts which stores all the information regarding an
I have a database with millions of phone numbers with free-for-all formatting. Ie, the
Looking to have a database query set all the instance variables in a class:
Say you have 2 database servers, one database is the 'master' database where all

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.