I have a database containing just over 100 tables. I have developed multiple summary forms to access various related tables. I now want to build a overview form to specify a search which will then pull up the related record on the various summary forms. Child Parent Image
The image attached is from the original MS Access database but shows how the main form references several summary forms.
Presently each form opens a self.db = Sqlite3.connect("PipeSpec.db") and self.cursor = self.db.cursor(). Is there a simple way to pass this connection to other forms, I am concerned this will turn into a memory hog, will that be the case?
Related
I am 100% new to ASP.NET and I've been working on this problem for a few weeks. I'm trying to have a very barebones website that when loaded will prompt the user for their dessert preference. If they like cakes, the website will display cake photos, if they like jelly, it will display jelly.
My first thought was to start with the SQL database. It has two tables, Jelly and Cakes, both have the same format for columns.
An integer for id, a varchar for name and a binarydata for storing the image.
Then I created the website on ASP.NET. I started by generating a ASP.NET Web App (MVC) in Microsoft Visual Studio. I tried to create a model class called Dessert that would create a dataset of either Jelly or Cakes dependent on what the user choose but I couldn't figure out how exactly to create that.
I went online and read some documentation and apparently ASP.NET can auto generate a SQL database based on your model? I toyed around with creating different models, trying to connect the model to my SQL database, auto-generating the SQL database with ASP.NET but I'll be honest and say, I haven't got a clue what I'm doing.
My initial feeling was to create a model, have some sort of starting page that asks the user their preference, the Dessert class gets made based on the user's preference and the webpages are dynamically displayed with whatever their preference was.
Any help on this would be appreciated. Even if it's just a link to a resource that can help me.
Thanks.
This involve many steps --
You create the db
Create Web Project
Add Option to connect with Database, you can use (Entity Framework, Plain ADO.NET, Dapper)
Create a db class to make methods that call db
Create model class to hold data returned from db
Create controller and call db class to get data and pass it to view
Create MVC view to show data and capture user intergation
For you use case I allready prepared some code and database, please look into this repo --
https://github.com/mataprasad/MyDesserts
I am currently undertaking an exercise to research on a number of JS MV* frameworks and select one that best suits the team's needs. Knockout is one of the contenders that I am learning about.
One of the most important requirements is for changes in the data in a view model to be broadcast to all the views that use such data. For example, lets say we have client details listed in a data grid on a page, clicking on any row in the data grid brings up a pop-up dialog where the user can edit the values of the selected row. When the change is made and the user clicks 'Save', the data is updated in the database. But what we also want is that the change be reflected in the local ko.observablearray and then for any other views that use this 'clients' collection to refresh themselves with the new data. In other words the views must refresh themselves with the data in ko.observablearray rather than get a fresh list from the database.
I have been successful in doing this - have one a single .cshtml file which houses the data grid and a form to create new row in the data grid. In this scenario, the data in the grid refreshes correctly. But when the change happens on a another cshtml file, I am not able to carry these changes across to the other views. Can this be done in knockout and if yes, please point me to an example of how and where this has been done.
I would use a Event aggregator pattern. I have made one for SignalR
https://github.com/AndersMalmgren/SignalR.EventAggregatorProxy
Install usign nuget
Install-Package SignalR.EventAggregatorProxy
If you have no use for SignalR you can then extract the relevant parts from my lib, demo here
http://jsfiddle.net/jh8JV/
I'm trying to show a Sharepoint list on an ASP page that's running on a different server to the Sharepoint site. I originally tried using the Server Object Model, but with no success (see: Using Sharepoint GridViews on server without SharePoint installed)
So I have settled for using the Client Object Model instead. Now this allows me to pull data from Sharepoint, however, and please correct me if I'm wrong, there is no built in functionality that allows you to bind ASP.net data tables/grid views to Sharepoint objects. The ASP.net page runs on a server that does not have Sharepoint installed.
I would very much like to use ASP.net grid view objects, as they're very design friendly (visible in the GUI) and provide a whole host of functionality - sorting, paging, and so on. These objects need to consume ASP data sets afaik (I'm new to ASP.net development), so I've created a data set object, and a data table to source the data from.
These data tables are clearly designed to retreive data from SQL based sources, as the only options Visual Studio provides for populating them is from the various SQL platforms. However I was able to use the GUI to add the columns I wanted to the data table. These column names correspond to columns of metadata in the Sharepoint list I want to retreive from.
Now can anyone provide me with the steps - preferably with regard to best practice, that I need to go through in order to ensure that the grid view is populated with values when the user loads the page. I already know how to access the values via the Sharepoint web service, but I'm just not sure how to get them into the ASP data set.
By making use of the GetListItems method, I can have all the items of a particular list in the form of XML node. All I need is to convert this XML into data set. Here is how you can convert the XML node to DataSet. You can iterate through the xml nodes and create rows to your dataset as shown here.
I want to use ASP.NET Dynamic Data for my next project, but there is a problem a can't manage to solve. In the database we manage authorization on a per-row basis. For example no user is permitted to see all rows of the Contracts table. So there is a Many to Many Relationship between Contracts and Users. So everytime Dynamic Data performs a Select to show all Contracts it has to look into the ContractUsers junction table to see what contracts the current user is permitted to see (filtered by UserID which will be stored in a session variable). Of course these junction tables should be invisible to the users.
By default Dynamic Data returns all rows of a table, so is it possible to customize this behaviour for every query the user performs?
I want to use Dynamic Data together with LINQ to SQL but if this task would much easier to accomplish using Entity Framework I would look into that too.
Thanks for your help and time.
Implementing such a solution in Dynamic Data it will probably require the creation of a custom Entity Template; not really easy but once done it will not require the creation of custom pages just the editing of the page templates.
I think it will be really usefull to check the excellent work on DD done by S.J.Naughton and presented on his blog.
Greetings, F.
You should not use dynamic data because you need full control over querying and manually write all linq queries to add your data level security. If you still insist on dynamic data be aware that you will still write most of pages yourselves and you will only use dynamic templates. You will have to manually define ever data source and correctly pass where condition to filter results based on logged user.
In addition linq-to-sql is not able to hide junction table and entity framework is able to do that only if junction table contains just two FKs for many-to-many relation. If this table contains any other column you want to use in the application you will have to map it as any other entity and dynamic data will show it as an entity.
Dynamic data are technology for quick creation of simple application where you need to provide access to database through web interface but what you describe is not a simple scenario. You need per record authorization which can differ among entity types.
I made an access vba application where all my architecting was simply creating a one-to-many relationship between a "status" table and a "data" table that contained all the other details of my record. Created a form with the single click of a button with my "status" table open, and wallah,,, I got a form for my open or closed records that had dropdowns for each field where theres a related table. For activity tracking, I had to make a many-to-many table , and made a one-to-many for the status of those activities and again, clicked the create form and I was in business. To finish things off all I did was integrate a checkbox in my data fields and put buttons on my status forms that act on the record that got checked, and I was done, fast & painlessly, kinda.
Is there any ASP.net code generation of a data control in where I can just structure my MYSQL database, make the relationship and generate code of the RELATED "status" table and get my form w its related subform with text fields & DDL's automatically generated, fast? If not, what would you consider is the next best approach (i.e. using excel for replicating repetitive code)?
Take a look at http://www.asp.net/dynamicdata
As far as I know (having not used it myself) it will do what you need, ie quickly generating data entry pages from an existing sql schema.
Access can actually create .net forms when you use access 2010. (the forms are real xaml or so called zammel forms). The beauty of this system is you get to keep the same point and click approach that allows you to build master forms with child sub-forms. You not have to write one line of code and you not ever see one connection string. Only downside of this great new system called "Access Web Services" is it requires SharePoint (enterprise).
So, this is a true access development for the web, but you continue to use the Access client to build those forms. Those forms scale out to many users since you using xaml forms and SharePoint. Here is a video of this in action:
http://www.youtube.com/watch?v=AU4mH0jPntI
At the half way in above, note how I switch to running the access application 100% in the browser.