Design Pattern For Database Interaction?

Mar 12, 2012

I've been studying design patterns off-and-on now for a project I've recently been working on. I've been fortunate with this last one not to have to work with databases, but will soon have an opportunity.

View 8 Replies


ADVERTISEMENT

Looking For Design Pattern / For Each Instead Of For With Index

Jun 4, 2012

Using VB.Net, I'm looking for best practices in dealing with the following idiom:[code]What I really want is something VB.Net doesn't offer -- additional and simultaneous iterators on For Each statements.[code]I'm interested in both Linq and non-Linq recommendations, comments about Copy method design, comparisions to C# or other languages.

View 3 Replies

Asp.net - Step By Step User Interaction Pattern?

Jul 1, 2011

I have a wizard where users need to fill out data. You cannot navigate to the second step until first step is completed.

I enforced this behavior by disabling/enabling "Next" button, but I really do not like this solution, since it seems not really elegant or safe here. What is the good approach on building step-by-step processes with enforcing step completion.

View 1 Replies

.net - Design Pattern For TypeOf Subclass?

Mar 4, 2012

I am working on a parser for a serial data protocol. I have an overarching Packet class, a couple sub-classes such as CommandPacket and StatusPacket, and then a few sub-classes of each of those:

[Code]..

While I don't think it is entirely relelvant to the discussion, I am doing this in VB.NET. There is also a similar (but not quite the same) question posted here: Java - subclass validation design pattern

View 2 Replies

C# - Design Pattern For Custom Events In .NET?

Feb 21, 2010

What is the proper design pattern for custom events in .NET (VB or C#).

I am refering to custom events, where in you override the AddHandler, RemoveHander, and RaiseEvent methods.

View 1 Replies

'Producer Consumer' Design Pattern Using Queues?

Jul 23, 2009

I'm trying to replicate a design pattern used in a graphical programming language called LabVIEW. One thread produces commands, and another thread, or series of threads, consumes the commands.This is very similar to using Queues in VB...but there doesn't seem to be an easy way to start the consumer thread when new items are added to the queue.

Here is what I would like to accomplish, please let me know if there is a straightforward way to accomplish this with out of box .Net functionality.1) Start the Consumer Thread...it sits idle, waiting for some new commands to appear in its Queue.2) Producer places a few commands into the Queue. Example: "Home X Axis", "Home Y Axis", "Initialize Pump", "Display Ready Message"3) Consumer thread 'wakes up' at seeing the new commands, then performs the 4 tasks specified in 2.4) Consumer thread goes 'idle' again, and simply waits for new commands to appear in the Queue.

Process can continue on and on forever. The main problem I see with Queues is that there is no 'Wait for Something to Appear in Queue then Retrieve it" functionality. I don't want to use a perpetual loop to keep checking ever n milliseconds.

View 1 Replies

C# - Anonymous Method Alternative For Design Pattern?

Apr 18, 2012

With C# anonymous delegates, we can avoid declaration of extra method, I know in VB.NET they're not available, but is there a design pattern that I can use so that I can avoid writing an extra method each time? I need it for SPSecurity.RunWithElevatedPrivileges which will be used a lot of times in our code.

[Code]...

View 1 Replies

C# - Design Pattern For Dealing With Syncing Variables?

Jan 30, 2012

Suppose I have two events:

Public Sub Control1Updated() Handles control1.TextChanged
control2.Text = SomeFunction(control1.Text)
End Sub

[code]....

Basically the pairs of {control1.Text, control2.Text} and {control2.Text, control1.Text} should be the same. If control1.Text is changed to let's say "a" then control2.Text is ALWAYS "b". If control2.Text is changed to "b" then control1.Text is ALWAYS "a". How do I achieve this with events without going into an infinite loop? [the best I can think of is to make a check if the other control.Text is already the desired value].

View 1 Replies

What Are The Features Of The Controller Class In The MVC Design Pattern

Aug 13, 2009

In the MVC design pattern we must use a controller(s) classes.

What are the fucntions (features) of the controller apart from handling communication bewteen Model and View?e.eg; can we include input validation code in the controller?

View 4 Replies

What Type Of Code Should Put In The Controller In The MVC Design Pattern

Jul 7, 2009

In teh MVC design pattern, Controller is strongly related to the view (GUI). IN my application i need to generated a new BrandID, i used stored procedure to retreive the highest BrandID from teh DB (The model calls the stored procedure and sends the retreival value to the Controller), then in the controller increments the BrandID by "1" to create a new brand ID. SInce, controller is strogly related to "view", should i include this "brandID increment" part in teh controller or in the model classes?

View 3 Replies

C# - Which Design Pattern For Activity Logging (Audit Trailing)

Jun 15, 2012

I have a winform which allows people to edit data from a database, to simplify things assume there is a Customer table in database with 3 fields - Name, City, Country. Through winform(s) people can Add/Edit/Delete customers.For each of these actions we need to save:

What the field names are (Name,City,Country in this case)What the field values were before they were modified What the field values are after they are modified.If the action is Add or Delete then 2 and 3 will be the same.I have already implemented this using XMLSerialisation (but not using any of the design patterns) and my XML output looks like this.

<?xml version="1.0" encoding="utf-8"?>
<ActivityItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<UserID>26</UserID>
<FormTitle>frmCustomer</FormTitle>

[code]....

The solution can handle different areas of the system with different number of fields (i.e the same thing works when you are modifying Products for instance).is there a well defined design pattern to deal with this kind of behavior?

View 2 Replies

Lifetime Of Multiple Instances Of An Object / Design Pattern?

Sep 5, 2009

having difficulty with understanding object lifetime / instantiation.I have a windows from with a datagridview and a panel. The datagridview has a checkbox column and a list of names which is populated from a database.The panel has a few text boxes (e.g. name, age, favourite sports team) and a 'save changes' button.

The idea is that when the user selects a person in the datagridview by checking the appropriate checkbox then the panel shows the relevant data for that person (name, age, fav sports team) by pulling the data from a database. If the user would like to update the person's details they can do so by typing in the textboxes and then clicking the 'save changes' button. All quite simple so far.

The way I have designed this is to have a 'panel' class and to create an instance when the user checks a checkbox.(NB - the reason I have created a 'panel' class is that I intend to replicate the datagridview and panel on other tabpages within my form and thought it would be useful to have a generic 'panel' class that I could re-use.)

My code looks a bit like this:

If CheckBoxClicked Then
Dim UpdatePanel As New UpdatePanel(MyForm.NameTextBox, MyForm.AgeTextBox, MyForm.FavSportTeamTextBox, MyForm.SaveButton)
UpdatePanel.GetData()
...

When the user clicks the SaveButton the data is updated to the database and I have a display message (simple textbox) which says "Update successful" and displays for 5 seconds before hiding itself.

Here is the problem:Suppose a user checks a checkbox, reviews the data and does not make any changes, and then checks another checkbox and decides to update the data by clicking the 'save changes' button. What happens is that the "Update successful" message is displayed twice.

I think this is because every time the user checks a checkbox an instance of UpdatePanel is created. If a I select five different people using the checkboxes and then hit 'save changes' I get five "Update successful" messages.

I am not sure how to overcome this. It feels like each time a checkbox is clicked I need to check if an instance of UpdatePanel exists and then destroy it. I tried using UpdatePanel = Nothing and also investigated IDisposable and GC.Collect() but with no luck.

[code]....

View 1 Replies

Asp.net - Refactor To Design Pattern: Displaying/hiding Different Combinations Of Controls Based On State?

May 26, 2009

Assume you have controls A, B, C, D and E all with a Visibility property. You also have states 1,2,3,4,5 and 6 in which various combinations of your controls would be displayed. Currently this is being handled by switch statements for each state: i.e.

Select Case PageState
case "1"
a.visible = false
b.visible = true

[code]....

As you can imagine, this becomes a pain as every state needs a show/hide statement for each control. How can I refactor this so that adding controls and/or states becomes trivial?My first instinct is to extend the control and add a collection of states that it should display for but this sounds like overkill.

Edit:I was deliberately vague in my question in case this has other implications. In my current instance the "controls" in question are ASP Panels. Does that change anything?

View 4 Replies

C# - Get A Code Template/design Pattern Can Use When Reacting To Mouse Clicks Or Button Presses?

May 3, 2011

One of the problems that I constantly see with Winforms applications is that the GUI thread is stuck while a long-running task is running or just plain stops refreshing (yes, I know - needs threading). Is there a code template/design pattern I can use when reacting to mouse clicks or button presses? Should there be a processing thread always running in the GUI app? Basically, how do I write a great Winforms Application that is easy to maintain and doesn't have any quirky refresh bugs?

View 4 Replies

Database Interaction From Within VB 2010?

Jun 29, 2010

I am using VB within the Visual Studio 2010 platform.I have created a simple Database with Access.I have connected my database to my VB 2010 project using the Visual Basic BindingNavigator object.I now need to navigate my Database with code from within VB 2010.

1) More specifically I need VB routines that allow me to:

·
GoTo first record
·
GoTo a specific record
·
MoveDown one record at the time and sense the EOF.

2)I need to add new records at the end of my database as data become available through a change in four text boxes.

3)I need any other VB 2010 statement or routine that might apply to Database navigation and communication from within VB 2010.

My Database consists of four columns: Date, Time, Bid (Double Integer), and Ask (Double Integer), and was created with Access.Is Access the best solution for creating a Database today?

View 2 Replies

Interaction With Database (Reading / Writing Tables And Fields)

May 2, 2012

Using Visual Basic 2008 express, I would like to access a database with 2 tables, one table (useraccounts) which has Users and Password and ID, and the other table which has information (linktable). Basically I would like to do a login form which reads from the table useraccounts and be able to create new users which will write into the database.

Another is that I have a form with a number of links which I would like to store in the table 'linktable' and it basically just gets the links from the table and straight to the form where it is used. I have tried using access or the .mdf files that visual basic has but I have been unable to find an answer for either.

I wouldn't mind using either access or the .mdf file for the database, I would just like it to work. Overall I am trying to get:
Login form which reads from database table 'useraccounts' and has a new user feature
Just a form that can read / write to the database once the save button is clicked.

View 1 Replies

Very Simple Database Interaction - Using Textbox To Pull User ID From The Table

Jun 25, 2010

I have one table here with a list of UserIDs, Users, and ClientCodes. Each user can be assigned a client code to view that client's data elsewhere. Right now I have to change it for everyone via SQL Server and actually going into the table manually, but I'm trying to make a simple little program that will let the user change it themselves. All I need is a textbox that pulls the user based on a certain UserID from the table, and a drop down list that will not only show the current ClientCode they're set to, but allow me to change it and save that change to the table in the database.

What's the best way to go about this? I tried using the wizards but I guess that's not the best way to go about it. I have it displaying the correct user and their current ClientCode but that's about it.

View 4 Replies

Send Formatted HTML From A Database To A Specific (non-default) Printer With No User Interaction?

Apr 5, 2011

I'm currently pulling HTML data from a database and displaying it in a WebBrowser control in my VB.Net application so that it's correctly rendered. The next step is to print it, but I need to be able to send it to a specific printer rather than the default printer. How can I accomplish this?

View 1 Replies

Printing - Send Formatted HTML From A Database To A Specific (non-default) Printer With No User Interaction In .Net?

Jul 16, 2010

I'm currently pulling HTML data from a database and displaying it in a WebBrowser control in my VB.Net application so that it's correctly rendered. The next step is to print it, but I need to be able to send it to a specific printer rather than the default printer.

View 1 Replies

Database Access Pattern Code Review?

Nov 6, 2010

Anyone here kind enough to give me a code review on the following pattern that I have used for database access? I have provided one of the simpler datalayers to show the basic idea.In particular I am starting to question if using shared methods was a good idea and what problems may arise from that? Will this implementation fail in a threaded environment like ASP.Net?

Public Interface IFillable
Sub Fill(ByVal Datareader As Data.IDataReader)
End Interface

[code].....

View 1 Replies

Asp.net - (3 Tierish) Database Access Pattern Code Review?

Jan 19, 2011

Anyone here kind enough to give me a code review on the following pattern that I have used for database access? I have provided one of the simpler datalayers to show the basic idea.In particular I am starting to question if using shared methods was a good idea and what problems may arise from that? Will this implementation fail in a threaded environment like ASP.Net?

[Code]...

View 1 Replies

Database Connectivity - Design The Database In Access2003 And Forms

Jun 3, 2010

I m working on an school management application, i design the database in access2003 and forms in vb.net2005. but i dont have any idea about the database conectivity. with the help of a book to connect with the db but i cannot save the data in the mdb file. in my application 1 add the followin buttons add new record modify record delete search using id or enrolment no.

View 1 Replies

Multilingual Database Design In Sql?

Jan 11, 2012

Need a procedure in SQL for translate a datatable in English to Arabic .I am having English table which is having category ID ,Code etc upto 25 columns in the SQL Database.We want to translate this table to arabic when user opts for Arabic .So need a procedure to convert this English table to Arabic.Do i want to use google translator for this case . Then how will it is linked with database .

View 1 Replies

Database Application Design Recommendations?

Mar 22, 2012

The main purpose of the my app that I need your help with is, to deliver an always (or close to) up to date a list of files for the user to choose from for a variety of common purposes. For instance, opening the selected file in its native client editor application so the user can make changes. Another purposes would be to print the file, and I have others.

If nothing else (meaning recommendations for a better design that still keep my desired in mind) I'd like ideas on how to update my complex DataSet (background processing options, what's the most efficeient/quickest way to update my DataSet) as the list of files changes while my app is running and my app is designed to never close due to the long amount of time it take to load it initially.

The list must be always kept up to date while my app is running because not only the intial loading of data takes a lot of time but updates (new/modified/deleted) could potentially take too long depending on not only how much data to update/add (new files) but how efficeient my code is in updating the list. To be perfectly clear: If a new file is created then it need to be somehow (automatically preferably or manually i.e. button code) add to the list. If a file is deleted then it needs to bet removed from the list. And if the file has changed, perhaps some of it metadata or thumbnail image have changes so update the file's data in the list. All of which (new/modified/deleted) need to be as real-time as possble without degrading the server too much and without the user waiting more than a handful of seconds.

Listing all the files as quick as possible whether that be with or without metadata initially is very important because most of the time the user is going to filter (or scroll the list by typing) for a partial file name. Once the user filters/scrolls to the desired file there's a very good chance that he/she isn't even interested in the metadata, most of the time the user wants my app to open the selected file in its native client editor application so he/she can view or modify the file. The initial
load time of the data doesn't concern me as much as updates because the user can possibly do other things while it initially loads all the data as long as it not too long (more than a few minutes). From there the updates will either be automatic if possible (most desirable from a users standpoint) or the user initiated (e.g. button). Plus I'm thinking the updates might need to be done with a few different background processes (multiple threads) because I think I need one for periodic updates (e.g. every
15 minutes) and one background process for page updates meaning whatever the user has either scrolled to or filtered for, more accurately all files currently display to the user will be systematically update in the background so the user can still operate my app.

I'm currently using SqlDataAdapter.Fill to fill a DataSet object variable (which is bound [BindingSource] to a DataGridview control) to first populate the DataSet from the SQL query and then prorgammatically adds records (DataRow) for local files but please make recommendations. I don't mind big changes or starting over if necessary, I just want the best app possible based on the aforementioned criteria. I'm not sure if it complicates matters but I've also added custom columns in the DataSet for some special needs (thumbnail of files, booleans for tracking custom statuses). For the local files I'm currently populating the DataSet prorammatically (iterating a path/file string collect made by System.IO.Directory.GetFiles) since the list is first (and very quickly) populated with Vault files (which is always a far larger list than the local files) so . Again, I don't have to take this direction, make recommendations.

View 11 Replies

Design Id Card Using Data From Database?

May 18, 2012

i try using both detail view and form view but they are not flexible enough to place my picture where i want it

View 1 Replies

Sql Server :: Database Design And Normalization?

Mar 29, 2011

I am developing an "AddressBook" like project in VB.NET. While developing database in SQL Server2005, i want to follow the principals of normalization and keep its degree of normalization as high as possible. Fields i am using are these.

Create table AddressBook_Contact
(
Contact_ID int Primary Key,FirstName varchar(15),MiddleName varchar(15),LastName

[code]......

View 3 Replies

[OOD] Class Design For With Database Back End

Feb 6, 2010

I was hoping that I could get some guidance from some of you guys on Object Design with Database back ends. I am trying to build what could be considered to be my first full scale application, which is a student tracker (simplification). While I have a reasonable idea of how I would go about designing the classes for the system, the bit that I don't know how to do is, how I would go about getting the data to and from the database.

For example with my other applications, I have done a couple of things;

1) Gathered all the data when the application started up, creating the objects then. Then when the application closed sending the data back to the database.

2) Have the code which deals with getting the data in the specific class, so the student class for example would take only one constructor argument which would be the studentID, then the class code would connect to the database and populate the object fields as appropriate.

3) Variations of the above. I have also looked into LINQ, which seems like it would be very useful if you don't expect your classes to deal with any business logic and just data, but I suppose it would be possible to create a wrapper class that would include the business logic.

[Code]....

View 1 Replies

[OOD] Class Design For With Database Back End?

Mar 11, 2010

I was hoping that I could get some guidance from some of you guys on Object Design with Database back ends.I am trying to build what could be considered to be my first full scale application, which is a student tracker (simplification). While I have a reasonable idea of how I would go about designing the classes for the system, the bit that I don't know how to do is, how I would go about getting the data to and from the database

View 3 Replies

Create Database User Interface Design?

Mar 31, 2012

I am designing a database using access 2010 and I ve been asked to design the user interface with Visual basic.I actually have designed tables and their relationship and did some queries according to the requirements. how do I create user interface in VB from this point knowing I don't have any form and report designed in access?

View 6 Replies

Design Approach For Utilizing Data From A Database

Nov 6, 2011

There exists a database that holds information on each planet in the solar system. The database has multiple tables.The program intends to access this data to display it to the user in a variety of manners. The program does not intend to manipulate the data at its source, though calculations on two fields may be performed to determine certain display characteristics.What is the optimal method for accessing the data?My initial approach, (read: gut feeling, no research) was to take each related row of data from the database and create an object of a custom class based on the data. So you might wind up with:[code]Then use these objects to perform whatever actions the program needed to. I ran into a lot of problems trying to implement this, so that I believe my design approach is fundamentally flawed.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved