How can i compare two databases and their tables

i have a text.txt file then
i will insert it into db_header and db_details
db_header has tbl_pcountheader with fld_Rack_No(char) PK and fld_DateAdded(date) PK
db_details has tbl_pcountdetails with fld_Rack_No(char) PK, fld_Barcode(char) PK and fld_Quantity(int)
then i will lookup in db_products
db_products has tbl_products and tbl_barcodes
tbl_products has fld_ItemCode
tbl_barcodes has fld_Barcode and fld_ItemCode
now i want to make a prompt contains
Rack No: Date:
Counter No:
Barcode | Item Code | Item Description | Quantity
how can i fill up this by comparing db_details and db_products?
Private Sub bt_upload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_upload.Click
If saveCheckBox.Checked = False Then
MsgBox("Please click the box to continue.")
Return
End If
If lb_file.SelectedItem Is Nothing Then
MessageBox.Show("Please select a file.")
Exit Sub
End If
' Obtain the file path from the list box selection.
Dim filePath = lb_file.SelectedItem.ToString
' Verify that the file was not removed since the Browse button was clicked.
If System.IO.File.Exists(filePath) = False Then
MessageBox.Show("File Not Found: " & filePath)
Exit Sub
End If
' Obtain file information in a string.
Dim fileInfoText As String = GetTextForOutput(filePath)
'LookUP db_header, db_details and db_products
Dim cs As String = "Database=;Data Source=localhost;" _
& "User Id=root;Password=1234"
Dim conn As New MySqlConnection(cs)
Dim ds As New DataSet
Dim da As New MySqlDataAdapter
Dim cmd As New MySqlCommand
Dim dt As New DataTable
Dim stm As String = "SELECT tbl_pcountheader.fld_Rack_No, tbl_pcountheader.fld_DateAdded, tbl_pcountdetails.fld_Barcode, tbl_products.fld_ItemCode, tbl_products.fld_ItemDesc, tbl_pcountdetails.fld_Quantity FROM db_header.tbl_pcountheader INNER JOIN db_details.tbl_pcountdetails ON db_details.tbl_pcountdetails.fld_Rack_No = db_header.tbl_pcountheader.fld_Rack_No INNER JOIN db_products.tbl_barcodes ON db_details.tbl_pcountdetails.fld_Barcode = db_products.tbl_barcodes.fld_Barcode INNER JOIN db_products.tbl_products ON db_products.tbl_barcodes.fld_ItemCode_fk = db_products.tbl_products.fld_ItemCode GROUP BY tbl_pcountheader.fld_Rack_No, tbl_pcountheader.fld_DateAdded ORDER BY tbl_pcountheader.fld_Rack_No"
ds = New DataSet
Try
conn.Open()
da = New MySqlDataAdapter(stm, conn)
da.Fill(ds, "tbl_pcountheader")
DataGridView1.DataSource = ds.Tables("tbl_pcountheader")
Dim headers = (From header As DataGridViewColumn In DataGridView1.Columns.Cast(Of DataGridViewColumn)() _
Select header.HeaderText).ToArray
Dim rows = From row As DataGridViewRow In DataGridView1.Rows.Cast(Of DataGridViewRow)() _
Where Not row.IsNewRow _
Select Array.ConvertAll(row.Cells.Cast(Of DataGridViewCell).ToArray, Function(c) If(c.Value IsNot Nothing, c.Value.ToString, ""))
Using sw As New IO.StreamWriter("c:\report.txt", append:=True)
sw.WriteLine(String.Join(",", headers))
For Each r In rows
sw.WriteLine(String.Join(",", r))
Next
End Using
ds.WriteXmlSchema("Sample.xml")
Dim cr As New CrystalReport1()
cr.SetDataSource(ds)
CrystalReportviewer1.ReportSource = cr
CrystalReportviewer1.Refresh()
Catch ex As MySqlException
MsgBox("Error: " & ex.ToString())
Finally
conn.Close()
End Try
' Show the file information.
Dim PrintPrompt As String
PrintPrompt = MsgBox(fileInfoText, MsgBoxStyle.YesNo, "ProofList")
If PrintPrompt = vbYes Then
'fileInfoText.print()
If saveCheckBox.Checked = True Then
' Place the log file in the same folder as the examined file.
Dim bakFolder As String = System.IO.Path.GetDirectoryName(filePath)
Dim bakFilePath = System.IO.Path.Combine(bakFolder, "back-up.bak")
Dim bakText As String = "Backed-Up: " & Date.Now.ToString & vbCrLf & fileInfoText & vbCrLf & vbCrLf
' Append text to the log file.
'System.IO.File.AppendAllText(bakFilePath, bakText)
My.Computer.FileSystem.WriteAllText(bakFilePath, bakText, append:=True)
'My.Computer.Network.UploadFile(bakFilePath, "C:\Documents and Settings\SAPC-TECH\My Documents\back-up file.bak", "", "", False, 1000)
'My.Computer.FileSystem.DeleteFile(bakFilePath)
'Form2.Show()
End If
'Note: This message box shows that you've uploaded a file and back up it.
MessageBox.Show("Already backed-up to ")
Else
'Me.Close()
'Application.Exit()
'End
End If
'Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
'Form2.Close()
'Me.Close()
End Sub
here's my final code that solves my problem.
i just make the environment of vb into mysql console
so that i can call all the database that i wanted.

Private Sub bt_upload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_upload.Click
If saveCheckBox.Checked = False Then
MsgBox("Please click the box to continue.")
Return
End If
If lb_file.SelectedItem Is Nothing Then
MessageBox.Show("Please select a file.")
Exit Sub
End If
' Obtain the file path from the list box selection.
Dim filePath = lb_file.SelectedItem.ToString
' Verify that the file was not removed since the Browse button was clicked.
If System.IO.File.Exists(filePath) = False Then
MessageBox.Show("File Not Found: " & filePath)
Exit Sub
End If
' Obtain file information in a string.
Dim fileInfoText As String = GetTextForOutput(filePath)
'LookUP comparison db_details to db_products
'Dim connString As String = "Database=db_products;Data Source=localhost;" & "User Id=root;Password=1234"
'Dim conn As New MySqlConnection(connString)
'Dim cmd As New MySqlCommand()
'Try
' conn.Open()
' cmd.Connection = conn
' cmd.CommandText = "SELECT Database1.dbo.TableName.ColumnName, Database2TableName.Name, 'The reason why Database 2 isnt defined is the fact that it has been defined in the connection" _
' FROM Database2TableName INNER JOIN _
' Database2TableName2 INNER JOIN _
' WHERE (Database1.dbo.TableName.ColumnName = '')"
' cmd.Prepare()
' cmd.ExecuteNonQuery()
' conn.Close()
'Catch ex As Exception
'End Try
' Show the file information.
Dim PrintPrompt As String
PrintPrompt = MsgBox(fileInfoText, MsgBoxStyle.YesNo, "ProofList")
If PrintPrompt = vbYes Then
'fileInfoText.print()
If saveCheckBox.Checked = True Then
' Place the log file in the same folder as the examined file.
Dim bakFolder As String = System.IO.Path.GetDirectoryName(filePath)
Dim bakFilePath = System.IO.Path.Combine(bakFolder, "back-up.bak")
Dim bakText As String = "Backed-Up: " & Date.Now.ToString & vbCrLf & fileInfoText & vbCrLf & vbCrLf
' Append text to the log file.
'System.IO.File.AppendAllText(bakFilePath, bakText)
My.Computer.FileSystem.WriteAllText(bakFilePath, bakText, append:=True)
'My.Computer.Network.UploadFile(bakFilePath, "C:\Documents and Settings\SAPC-TECH\My Documents\back-up file.bak", "", "", False, 1000)
'My.Computer.FileSystem.DeleteFile(bakFilePath)
Form2.Show()
End If
'Note: This message box shows that you've uploaded a file and back up it.
MessageBox.Show("Already backed-up to ")
Else
Me.Close()
Application.Exit()
End
End If
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
Form2.Close()
Me.Close()
End Sub
here's my code wherein i have to compare the two database and save it into .txt file
i just have to get this items
Rack No:
Date:
Counter No:
Barcode:
Item Code:
Item Description:
Quantity:
as a prooflist to be print out.

Similar Messages

  • How can I combine two databases, from two computers, to have one combined database of messages?

    My old XP computer recently died and I had to build a new Windows 8.1 machine. While I was down I used a laptop as a temporary replacement. Now my new machine is running fine and receiving e-mail, but I now have two databases--one on the new machine and one on the laptop. Both are based on a recent backup, so they are lengthy--except that the new machine's database has a hole in it for the period I was on the laptop and the laptop's database also has gaps. How can I combine two databases into one that includes the messages from both machines?
    Thanks in advance,
    profsimonie

    Thanks for your reply. My profile folder did not contain any MBOX files. I found them in another folder on another drive. The Import-Export tools simply transferred each folder to the current one as a sub-folder. Then I had to use ctrl-a to select everything in the folder and move them manually to the current folder (such as inbox). Then I could use the other utility you mentioned to remove the duplicates. This had to be done, one folder at a time, to combine each folder. It worked, but I had about thirty-five folders to deal with. The whole process took most of two days to complete. I wish there was a simple way to blend everything together in one action, but I could not find an add-on that would do this.
    Frank Simonie

  • How can I compare two summary field in cross-tab?

    <p>Dear expert:</p><p>I have one question for how can I compare two summary field in cross-tab?  I have following cross-table:</p><p>Type          Sector1     Sector2    Sector3       Total </p><p>Outlook         10            11           9              30         </p><p>Target            5              3           1               9</p><p>I want to compare the summary field(total) relationship percent, I want to get "9/30". Someone told me I must create the DB view or table via SQL, then can implete in Crystal Report. Can I implete it in Crystal Report via fomula or other function?</p><p>Thanks so much for your warm-hearted help!</p><p>Steven</p>

    Hello Steven, yes you can compare summary fields, If you are comparing Summary to Target, or vice versa - you can do it within Crystal Reports.
    1. In Suppress conditional formula, create 2 Global variables: CurrentOutlook and CurrentTarger and get the current value.
    2. In Display String formula for Total show ToText(CurrentTarget/CurrentOUtlook) + "%".
    For more difficult cases of compariing fields in cross--tab, you may look into http://www.relasoft.net/KB10001.html.
    Best,
    Alexander

  • How can I list all users and their DEFAULT tablespace?

    How can I list all users and their DEFAULT tablespace?
    Peter

    Peter, the following short article that lists the most heavily used Oracle rdbms dictionay views might be of interest based on your question:
    How do I find information about a database object: table, index, constraint, view, etc… in Oracle ? http://www.jlcomp.demon.co.uk/faq/object_info.html
    HTH -- Mark D Powell --

  • How can I synchronize two iphones and two ipods on one MAC

    How can I synchronize two iphones and two ipods on one MAC. My wife and i each have our own iPods and iPhones but share one MAC.

    What do you mean by synchronize; music, apps, calendars, email, etc? Do you two share the same Apple ID on all devices? An Apple ID can support up to 5 computers and many iDevices.
    I hope this helps.

  • HT1386 I copied my my iTunes music from an old computer to a Macbook Pro, but it did not copy the playlists on my nano. How can I transfer the playlists and their content from the nano to the Macbook

    I copied my iTunes music from an old computer to a new Macbook pro but it did not copy the playlists that are on my Nano. How can I copy the playlists and their content on the nano to the Macbook? If I automatically sync the nano from the Macbook, will it scrub the content and existing playlists on the nano?

    You need a third-party program like one of those discussed here:
    https://discussions.apple.com/message/2901170#2901170

  • How can I compare the actual and expected values in Unit testing when they are XML files?

    I have created a unit test for a method in VS 2008. My expected value and actual value are XMLs. Therefore though the output is same as I expect it gives an error as I am doing string comparison now. How can I compare these 2 XMLs in expected output and
    actual output format in Unit Testing?
    mayooran99

    In unit test, when you want to validate XML files, you feed them into the class / struct that you want to feed the XML into and compare the values there (You don't just feed it in XMLReader and feed it line by line, right? But if it really is, that's how
    you should also test it in unit tests).
    In short, how you'd use the XML in your code, that's how you should test it in unit test.

  • How can I use two database in Dataset in SSRS?

    Hi,
    I am using one query to generate my SSRS report. In that query I am using subquery. Now I am pulling data from multiple tales.
    DB used in sub query is different than the rest of the tables DB.(So total I am using 2 DB(Database))
    So I see that in SSRS, I can connect query(In DataSet Properties) to one DATA_SOURCE only, how can I use other database which is I used in sub-query?
    I have to move this SSRS into PROD and I can't hard code that sub-query's DB name in my query.
    Please give me suggestion. Thanks!!
    Vicky

    In SSRS 2008 R2 you can use the Lookup function (http://technet.microsoft.com/en-us/library/ee210531.aspx ) and LookupSet function (http://technet.microsoft.com/en-us/library/ee240819.aspx
    Depending on your security set up, you can reference a table in a second database on the same server using a three part name:  database.schema.table.  This is more likely to work for you if you wrap your SQL command in a stored procedure.
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

  • How can I compare two collections at the same time? (View two grid views)

    I have two collections containing some of the same images. (My Nikon D70 did not put an end-of-file on some images. I recovered them into a different collection.) Now I want to display both collections side-by-side in grid view. I will select those images in the "recovered" collection that correspond to the bad images in the "main" collection, add the ratings etc, and move just these to another collection.
    It is extremely frustrating to have to bounce back and forth between collections, remembering each image one by one and selecting it in the "recovered" collection. (The image names are not preserved in the "recovered" collection -- I have to go by what the image looks like.)
    LightRoom allows me to compare photos in the compare view. I want to compare collections in two grid views.

    CaptureTheLight,
    you have ran into a situation when you have to compare two sets of images and now you're wondering how come Lightroom doesn't have such "obviously necessary" functionality? But you have to admit it, this is not such a common situation in a photographer's workflow recovers broken files and tries to compare them against themselves. I think it's a pretty specific feature you need. Still, Lightroom has enough powerful tools for editing and sorting images.
    For example...
    You could just put them all - "main" and "recovered" - into a single collection or into the Quick Collection. Label the entire "recovered" collection with, say, red and sort by capture time. Now you'll have everything side by side, ordered chronologically. The "recovered" images will stay next to the "main" images since their capture time will be the same, and they will also stand out since they have the red label.
    Make the thumbnails bigger and set up the grid view so it tints the thumbnail cell are tinted with the label color. Now, you can go quickly through them visually checking labeled vs unlabeled.

  • How can I compare two periods in a report based on parameters

    Hi all,
    I'm wondering how can I create a matrix report which compares the sales of two periods. These periods are variable and coming from the parameter section that the user is using. For example, I have got the following table "Sales". Columns are:
    ID (not visible in report, can be used to lookup)
    Country
    Customer
    Year
    Quarter
    Month
    Gross sales
    The output that I would like to get is the following
    Parameter period 1: 2013 Q1
    Parameter period 2: 2013 Q3
    The report should look something like this:
                                          2013 Q1         
    2013 Q3
    USA                Microsoft         50000          75000
    So in the third column you'll see the sales based on parameter period 1, and the fourth column shows the sales based on parameter period 2.
    Thanks for the help!

    Just to be sure I understand...
    You have 1 primary dataset that returns records that will be displayed in a tablix in your report. The data will include sales information records from various years, quarters, etc. You want your report user to be able to select 2 sets of data for comparison
    based on quarter. Is this correct?
    To do this, start by adding a Matrix to the report. Set the Column Group to group on the expression:
    =CStr(Fields!Year.Value)+" "+Fields!Quarter.Value
    Set this same formula as the group header. Now Set the existing Row Group to group on Customer. Add a parent group above this Row Group and group on Country. In the detail cell set the value to:
    =Sum(Fields!GrossSales.Value)
    You will also need to access the tablix properties and set a filter as follows:
    Expression: =CStr(Fields!Year.Value)+" "+Fields!Quarter.Value
    Operator: In
    Value: @Quarters
    For this filter to work, you will need to create the @Quarters parameter as follows:
    On General tab:
    Name - Quarters
    Prompt - Select Quarters to Compare
    Data type - Text
    Allow multiple values - Checked
    Visible - Selected
    Available Values:
    Get values from query - Selected
    Dataset - dsQuarters
    Value field - YearQuarter
    Label field - YearQuarter
    Default Values:
    No default value - Selected
    Advanced: Leave at default settings
    For the parameter to work you need to create the dsQuarters dataset. This dataset needs to return a single column of distinct values for Year + " " + Quarter based on the same query that you use for your primary dataset. Add the distinct keyword (if using
    TSql) or equivelent and eliminate all of the unnecessary columns. Set it to return Year + " " + Quarter AS YearQuarter.
    Let me know if you have questions or if I missed something.
    "You will find a fortune, though it will not be the one you seek." -
    Blind Seer, O Brother Where Art Thou
    Please Mark posts as answers or helpful so that others may find the fortune they seek.

  • How can I use two database in an application?

    When I use two database like CloudscapeDB and TestDB in J2EE1.3.1, I always get some exceptions, which is unknow source about one of them.I am doing a CMP entity bean application. Can someone tell how to set up the environment and what is problem about the exceptions I met?
    Thanks.

    Hi,
    The basics for using the two databases is simple.
    For database configuration you have to provide the driver class name, url, schema name and password during the creation of the connection pools. So u can create a as many no. of connection pools as the no. of the databases.
    Hope it will work..

  • How can i compare two color images in vision builder for AI?

    What i want to do is to compare two images. I have a base color image that represents the desired colors and tones. I have another image to be compared to the base image. What i want to do is to compare this two images to know how close they are regarding contents of color and tones. In other words, i want to know how close is image 2 to image 1 (base sample)....
    I would like to know how to get the content of certain colors in an image and then compare this values with the same values from another image.
    For example..i have two sheets of paper that contain various mixed colors...i want to know the amount of green, red an blue in each image and then comapre this values.
    What i want to do is to compare difer
    ent samples of fabrics. this fabrics must be of a specified color...but due to the process they may vary in tone or even color...so i want to compare this fabrics to a amster sample to see how close they are in color and tone..
    Anything would help since i dont have experience in this type of comparisons...thanks

    VBAI allows you to work with grayscale images only. You can acquire an image, use the vision assistant to convert it grayscale by extracting the luminance plane (or any of the other color planes) and then analyze the resulting grayscale image. To do what you are talking about, though, it would really be better to get Vision for labview. You could then take color images, compare color plains, use statistical functions to determine average color values, and so on.

  • Can I compare two databases from within SQL Server Management Studio

    Hi everyone.  I haven't found anything online, so I wanted to ask here.  I have two SQL Server databases running on our server.  One is the production database, and another is my development database that I use when I'm working on the program. 
    I add tables and columns and stuff to my development database, and was wondering if anyone knew of an easy way to from within Management Studio or something to compare the two databases to make sure that they are the same and show me any differences. 
    I generally add tables or columns to both databases at the same time, but I worry that one time I might forget, so I would like to be able to run some sort of compare / check to make sure before releases...
    Thanks everyone for your help.  I greatly appreciate it.

    There is a command line utility that is with Microsoft SQL Management Studio called
    tablediff:
    http://msdn.microsoft.com/en-us/library/ms162843%28v=sql.105%29.aspx
    An example:
    http://www.mssqltips.com/sqlservertip/1073/sql-server-tablediff-command-line-utility/
    And using it with multiple tables at once looks like some work but doable:
    http://blogs.msdn.com/b/repltalk/archive/2010/02/21/how-to-run-tablediff-utility-for-all-replicated-published-tables-in-sql-2005-or-sql-2008.aspx
    ...and some custom code to implement in an answer at StackOverflow:
    http://stackoverflow.com/questions/10688/best-tool-for-auto-generating-sql-change-scripts-for-sql-server?rq=1

  • How can i compare two excel files with different no. of records.

    Hi
    I am on to a small project that involves us to compare two excel files. i am able to do it but am struck up at a point. When i compare 2 different .csv files with different no. of lines i am only able to compare upto a point till when the number of lines is same in both the files.
    Eg. if source file has 8 lines and target file has 12 lines. The difference is displayed only till 8 lines and the remaining 4 lines in source lines are not shown.
    Can you help me in displaying those extra 4 lines in source file. I am attaching my code snippet below..
    while (((strLine = br.readLine()) != null) && ((strLine1 = br1.readLine())) != null)
                     String delims = "[;,\t,,,|]";
                    String[] tokens = strLine.split(delims);
                    String[] tokens1 = strLine1.split(delims);
                   if (tokens.length > tokens1.length)
                    for (int i = 0; i < tokens.length; i++) {
                        try {
                            if (!tokens.equals(tokens1[i])) {
    System.out.println(tokens[i] + "<----->" + tokens1[i]);
    out.write(sno + " \t" + lineNo1 + " \t\t" + tokens[i] + "\t\t\t\t" + tokens1[i]);
    out.println();
    sno++;
    } catch (Exception exception)
    out.write(sno + " \t" + lineNo1 + " \t\t" + tokens[i] + "\t\t\t\t" + "");
    out.println();
    Thanks & Regards                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    A CSV file is not an Excel file.
    But apart from that your logic makes no sense.
    If the 2 files are of different sizes the files are different by definition, so further comparison isn't needed, you're done.
    If you want to compare individual records, you need to compare all records from one file with all records from the other, unless the order of records is important in which case your current system might work.
    That system however is overly complicated for comparing CSV files.
    As you assume a single record per line, and if one can assume those records to have identical layout (so no leading or trailing whitespace in or between columns in one file that's not in the other) comparing records is simply a matter of comparing the entire lines.

  • How can Import Mysql my database and Table into website -

    Hi,
    friend i am using CS3 ,i made all need tables in database ,I need  to know
    how can import that database /table into website.
    I know  in domin there is admin Mysql inside i have found impotr/export/ but
    when  I click import i do not know where my database/table been save to  import it

    If all you are trying to do is change an existing tablepace from a single datafile to multiple datafiles, then a simple import will work fine. Just create the tablespace in the new database with multiple files, then do the import normally.
    If you want to move segments into different tablespaces, or change the names of the tablespaces, then you will need to precreate the tables before importing. Then, do the export with indexes=N and constraints=N. Run import with the resulting file, then re-create the constraints and indexes in the new tablespaces.
    TTFN
    John

Maybe you are looking for

  • Need direction on mixing

    Hey there. OK, so I'm really a beginner with this, please bear with me. I'm working on a project with a half dozen vocal tracks. Some of it is complicated so there's hundreds of little takes, ie regions. What I've been doing so far is constantly chan

  • Is there a way to force a new session so my "on new session" code will run?

    I'm using apex.oracle.com and I find values of application (global) and page items persisting across logins. I didn't expect that? I thought they would go away when I logged out of APEX. But I can change the values, logout, and log back in to the sam

  • L512 Wont Boot , Splash Screen then stuck blank screen and Fan in full throttle

    I was using the laptop, then it went to suspend mode due normal timeout. When it came back, the fan start to spin full throttle but it was functionating  beside that, normally. I restarted but then it never boot again. This is the process where it ge

  • Problem with RTPExport output video files

    Hi, I have a problem with RTPExport output video files. One side streams H263/RTP(AVTransmit2.java) and other write this steam to a file by RTPExport.java. When network conditions are ideal, output video file has same fps and same number of frames li

  • Only Person to Use my Skype Number is Blocked

    How do I unblock the one person who will use my Skype Number? He tried to phone me, and suddenly a female voice started talking so fast I could not follow what she said, and then the call ended. Now my friend cannot get through on my Skype number. Wh