Updating database in MySQL to SQL server in LightSwitch - c#

I have my LS with datasource made in MySQL. I decided to create same database in SQL Server, and when I use the "Update DataSource" of LS, all of my screen objects gone (the textboxes, labels, codes, etc.).
See Image.
Now my question is, how can I retain the screen objects even I change/update my datasource?
Is it possible? Or I have to recreate my screens?

I'm afraid you're going to have to recreate your screen objects. LightSwitch V1 doesn't have the ability to change "change" a screen's data source & still keep the existing screen objects, nor does it have a way to copy/paste screen elements either.
Sorry I had to be the bearer of "bad news".
We're hoping that scenarios like this will have been improved in V2.

Related

Change DataGridView connection and query on another form based on selection c#

I've been trying to find an answer for this and I'm completely lost.
I have an application that starts with a logon screen, after the client is logged on, it opens an MDI Form in which I have some items on a menu strip. One of them are assets (which is what the app will be used for), and the assets menu has a drop down with different assets to select, PC's, software etc.
When you click on PC's, another window opens within the MDI Form that has a DataGridView on it. And it works great but, I don't want to create a window for each and every connection or table in my databases, I feel this is bad practice.
So what I want is, to be able to change the DGV based on the asset selection, but for the life of me I can't figure out how to do this. I've been trying to pass parameters from one form to the other but the I just get different errors etc.
Can you guys please point me in the right direction? I am new to visual studio etc and want to learn these things, so I'm not asking for freebies so to speak, just what the logic should look like more or less.
Thanx!!
I don't have code for what I'm trying to do because I have no idea what the logic should look like.
I'm still trying wrap my head around how two forms communicate in a way I need.
I'm used having variables in a loop and when they change values the result changes. But in visual studio everything needs to be called which makes it a bit difficult for a rookie like me.
I did try sending sql commands via variables, but read that, that is a very bad idea.
I just want the DGV to change the data its showing based on a button selection.

Display data in a datagrid

I am working with C# in Visual Studio Community 2013. I have been trying to display data in a DataGrid that I have set up in a Window in my application. I've been finding various web pages including 1 or 2 from stackoverflow that are supposed to show ways of inserting and displaying the data, but every time I try one of these approaches, it doesn’t work for me.
Most of the time it seems like the code in these pages is from a previous or different version of Visual Studio and it just won’t work with Visual Studio Community 2013. I say that because I keep getting error messages in VS 2013 telling me the code isn’t correct in one way or another. This is when I’ve copied what’s in the corresponding web page exactly. Also, I’ve usually spent time looking into the errors without finding a way of resolving them.
I just want to be able to insert data into the DataGrid so that I can see it when I look at the app.
Please can someone show me how this needs to be done, or point me in the direction of a website/page that will show me how to get this working? This is obviously in Visual Studio Community 2013. I realise that I need to use data binding, but so far I haven’t found a way of doing that that actually works in my code.
I could paste the code I have so far up here, but there’s a lot of it and it would take up a lot of space. I will therefore hold off from doing that until someone actually asks for it.
At this stage I have the database data set up in class instances, which store the data that I want to display. The data is all just bits of text or numeric values. The instances are stored in a class that’s like a CollectionBase List, so that I can get individual instances from the list as I need them. My aim is to be able to display all of the instances, or just some of the instances from the list, dependent on how the user interacts with the application. However, at this stage I just want to be able to display something, and so far that hasn’t been possible.
I also have the DataGrid set up with all the required headers for the various columns, plus various settings that I found were needed from looking on line. These can obviously be changed as and when I get some guidance on how to sort this out.

Auto refresh databinded component after Database update

fellow devs! I need to know a strategy that will allow me to know that the database has been updated so that I can rebind respective controls (DropDownLists in this case. Here is a bit more details:
I have three Combo-Boxes (DropDownLists) on a MDI Parent form. Selecting a value from these combos will allow me to directly jump to the view form for the selected entity. Now, on MDI parent load, these combos are filled up. But once the application is running, anyone from anywhere can edit an entity or add a new one. i need to detect this and somehow cause the combo(s) to reload again.
Using Linq-2-SQL to load the Combos, Backend is a SQL 2005 DB on a SQL 2008 Server.
There's no builtin functionality to do all of this, so you'll have to roll your own.
One possibility I can see is to have a timer that periodically checks whether the items have been updated. You could do this by storing a last updated timestamp somewhere and checking against it. When you detect that the items changed, requery the data and rebuild the combos.
didn't try it, but you may take a look at the Sql Service Broker feature.
From my memory, it can create a file on the file system and you can monitor the creation of this file.
it's the feature used by the ASP.Net cache and its dependencies check.

Fast way to code forms in C# which is bind to SQL data

I am coming from MS-ACESS world and their programing habits, There was nice utility to make form from table, You can simply hit right click on table and make form for it. Now I looking for something similar for Visual Studio and WinForms. I am trying to develop simple application for which I need to have more then 30 forms for handling data, till now I designed database tables, keys and sprocs in SQL2008 and before I start coding forms for handling data, I asking You for main guidelines how to save my time while coding forms.
Click in VS2008 within the menu bar on Data - Show Data Sources.
In the new window you can select the first icon in the top left to create a new dataSource by help from a wizard.
Just step through it and select the database, tables, views, etc. you like.
When you're finished in the wizard, you can drag and drop the tables from the Data Sources window onto your form. You can also before drag and drop something click on the icon next to the table, view, etc. and change the container type which should be auto-generated.
Starting with these tips it should be quite easy to get a first version to run.
Last but not least:
These wizards create normal code files, which can be viewed and editing like any self written code file. So you can also take a look there to find out which base classes are needed to get all these thing to work to know how you can do some special task manually on yourself.
a simple way is to use a typed dataset (generated by vs) and to bind that to a datagridview.

access to standalone app with more stable database

Does anyone have experience of rapidly translating an access application into a standalone windows application? My current thoughts are to create an SQL database and a gui in c# and vb, or adobe flex 3.
As with acces, the GUI would mainly comprise of controls such as radio buttons, combo box (populated from a table), check boxes, text boxes, text areas and data grids. It will also need the ability to create reports as access does.
Any advice based would be appreciated.
Happy new year.
Use the upsize wizard (tools menu) to port the data to SQL Server
Carry on using Access as a front end
Change the schema as needed, hide change behind views for Access
Write a new GUI in asp.net or WinForms
sqlite may be the choice of database. It is simple, a self-contained, embeddable, zero-configuration SQL database engine. you don't need any database server as sqlite is file-based.
I guess vb.net 2008 can be used as it is very easy to generate GUI.

Categories