VB.net Fill Dataset at Application Start - sql-server

I have a winforms application that has an sql server backend. I have some tables that have static data, lookup tables, that I would like to fill in my dataset at application start to be used throughout the application when needed.
Normally in a form I would use something like this: Me.TEMSWBSETableAdapter.Fill(Me.EMS_DS.TEMSWBSE)
But I would have to do that in every form that required that data. The problem is it takes awhile to load that data, so I would like to load the data at startup in a background worker that can be used by any form that requires it. Basically filling the dataset with that data for use throughout.
I am not sure how to do this. Can someone point me in the right direction.
Thanks

you first need to implement DataReder object that can retrieve data with out creating a database TableAdapter. this will load your data with forward only and read only mode of the ADO.net mechanism.then you can implement ExecuteNonQuery() method to append the changes directly to the database.

Related

Tools for compare data before writing into db

I am writing a project which needs to scrape data from a website, I am using pyspider, and it runs automatically every 24 hours(scraping the data every 24hours). Problem is , before writing the new data entry into the dB, I want to compare the new data with the existing data in the dB.
Is there a tool/lib I can use?
I am running my project on aws, what’s the best tool I can use to work with aws?
My idea is to set up some rule for the data to update/insert into the dB, but when the new data is somehow conflict with rule then I will be able to view the data/scrape log(where the tool will label it as pending)and waiting for admin to do further operation.
Thanks in advance.
[List of data compare, synchronization and migration tools.]https://dbmstools.com/categories/data-compare-tools
visit there. it might be helpful

How does varbinary datatype work to store image for a user to view in Access front end?

I did some research and the web has taken me all over the place and I still haven't found a suitable solution or guide to what I am trying to achieve.
I read up a similar post to what I am asking. Except that's #php
Retrieving Image in SQL Server (varbinary)
Update:
The "conventional" way is the create file directory and file path. This was my initial method to get the front end up and running for the user.
My sup actually advised that I use this hash method nonsense which he can't even explain properly to me.
A user must be able to insert an image on the form, generate a report displaying the image as well.
How does the varbinary work to link sql and Access for what I am trying to achieve? I am currently playing around with my development to resolve it.
Any clarification?
I have no other way of putting this question after my first edit.
This is the form
For each form entry a user should insert a picture to support the Findings.
A VARBINARY field in SQL server is a field that stores binary data, and is often used for storing files. You can fit entire files in this field.
If you have a VARBINARY field in SQL server, and create a linked table in Access to the table with that field, it gets interpreted as an OLE object, since OLE objects are binary data too.
You can use the Bound object frame control in Access to save images into OLE objects, both as an image (which is displayable), or as a package. This does not require any code. You can right click the field -> Insert Object -> Bitmap Image to insert bitmap images into an OLE field. However, this stores OLE object data along with the image data, which makes it very hard to work with using code, and nearly impossible in non-vba applications. Using this approach is only justifiable if you're sure you're going to stick with Access for the lifetime of the database, in my opinion.
I've shared an example on working with VBA code and the OLE object here, but that uses hacky code that executes GUI operations. It's nearly impossible to port to other applications. I recommend you use the next way instead.
Alternatively, you can directly store binary data in the OLE object/Varbinary field. This makes it a lot easier to deal with using VBA code or any future application, since it's just the file data stored in the field, there's no OLE object data stored with it. I've shared code to load binary data in a field and save it back to disk here.
The hard part of this puzzle, if you're just working with binary image data, is displaying the image to the user. I've shared 3 approaches here, with code for one one of them. However, that's quite complex VBA code.

How to use a web service as a datasource in Spotfire

There is a use case in which we would like to add columns from the data of a webservice to our original sql data table.
If anybody has done that then pls do comment.
Shadowfax is correct that you should review the How to Ask guide.
that said, Spotfire offers this feature in two ways:
use IronPython scripting attached to an action control to retrieve the data. this is a very rigid solution that offers no caching, and the data must be retrieved and placed in memory each time the document is opened. I'll leave you to the search feature here on SO; I've posted a sample document somewhere.
the ideal solution is to use a separate product called Spotfire Advanced Data Services. this data federation layer can mashup data and perform advanced, custom caching based on your needs. the data is then exposed as an information link in Spotfire Server. you'll need to talk to your TIBCO sales rep about this.
I would use a Web Server to consume the Web Service and write it to your DB.
But here is the hard way:
Step 1: Use IronPython Script to retrieve WS Data, and form a Data Table or Document Property (https://www.tibco.com/blog/2014/03/03/streaming-xml-and-json-data-from-the-web-directly-into-spotfire-clients-using-script-controls/)
Step 2: Write a Stored Procedure in your DB and use IronPython to call the procedure (using a button, so this will be a manual step) and pass the Data Table or Document Property as parameter. (Here is an ironpython alternative: http://spotfired.blogspot.com/2014/04/write-back-to-database-from-spotfire.html)

Change Implementation of Select, Update, and Insert in SQL Server

To give you the question first: I want to know if it is possible to create a stored procedure or something in SQL Server that intercepts and translates SELECT, INSERT, and UPDATE commands. Now for the explanation:
I am writing a web application to replace an old desktop app. Its a business app which is basically a database interface with reports and searches and all the good ol' CRUD. The new and old apps need to live in harmony together since some customers may be using the old and new together to access the same DB.
My problem is that the original database format stores most data in a single blob of text (1 nvarchar(MAX) field). I want to add functionality to search on fields stored in the blob, but it will be cumbersome and slow. I would like to update the database format without changing the desktop app at all, hence the question above.
It occurs to me that I could do this on the client by writing a wrapper class for the data access object and then do a bulk replace in the client code to reference the wrapper, but I want to know what my options are on the server as well.
In case anyone wants to know, the old app is in VB6 and the new in C#.
EDIT
Alright, so it looks like if I do anything on the server side we are looking at adding stored procedures and then updating the client VB6 code to reference the stored procs. Do something like a bulk replace of SELECT with sp_oldselect ... To return the data in a different format. I'm guessing a client-side wrapper would be the best solution for the time-being. Old apps die hard.
You can create a bunch of views for the old client and let it to query those views. It will be slow as hell in most cases, but it can 'replace' the select query. For updates and insert.. well.. instead of triggers on the views could help is some cases, but it will require lots of processing.
However my suggestion is to provide exactly the same functionality in the web app and deprecate the desktop app. When the desktop app's share is low enough, stop supporting it. From this point, you are (mostly) free to add new functions, upgrade the database schema, etc.
I agree with JonH, that alot can go wrong here, but you can try and read up on the INSTEAD OF Triggers in MS SQL server here: https://technet.microsoft.com/en-us/library/ms179288(v=sql.105).aspx

Merging ACCESS projects (transferring a switchboard)

I am enhancing and fixing the forms/queries/VBcode etc. for an access 2007 database. The current version is being actively used and when I am done with my changes I need to transfer in my changes without disrupting the data stored in the tables already in the running mdb.
I'm not entirely sure how to handle the "merge" when the time comes. As an experiment I have a local backup copy of the version I started working on and used the import external Access data option. This imported the new forms, queries, vb, etc. But the only hang up is that the switchboard form isn't the new. Switchboard forms of course are guided by the switchboard manager but I was hoping that all that logic is held inside the form itself somehow. It seems this is not the case. After the import there is a new form of the same name with a number after it as expected, and the correct create/modify date. But when open it looks exactly the same as the old switchboard.
Any ideas?
It sounds to me as if you have both the data and the forms etc in the one database. This is not a good idea at all and if you are updating, it is the ideal time to correct the problem. If you split the database, any updates to forms and code can be simply copied to the user without worrying about the data. You will find some notes here: http://office.microsoft.com/en-us/access-help/split-an-access-database-HA010342026.aspx
The Access switchboard manager uses a table named Switchboard Items to dynamically populate switchboard form pages. You will need to transfer the updated version of that table to make your revised switchboard pages available in the other project.

Resources