Add record to access database
Add record to access database
Add record to access database
Add record to access database
Add record to access database
Add record to access database Add record to access database Add record to access database Add record to access database Add record to access database Add record to access database Add record to access database Add record to access database
Add record to access database Add record to access database
Add record to access database
Go Back  Xtreme Visual Basic Talk > > > Add record to access database


Reply
 
Thread Tools Display Modes
  #1  
Old 02-08-2013, 04:32 PM
brown brown is offline
Freshman
 
Join Date: Jan 2013
Posts: 39
Default Add record to access database


Sorry for all these questions

Throughout my program it collects data from the user.

When I click the confirm button I would like it to add a new row to the Booking table in the database, and insert the values inputted

Now all these values have just been collected up as variables and placed in labels at the moment for printing.

So essentially it needs to take a copy of all the details and place them into the correct column of the database on a new row, thus creating a new booking.

The first column of the database is BookingID which is a unique number which is not collected, so the input needs to start on the second column and the first needs to be auto filled

PLEASE HELP
Reply With Quote
  #2  
Old 02-09-2013, 02:34 PM
hDC_0Add record to access database hDC_0 is offline
Contributor

* Expert *
 
Join Date: Feb 2004
Posts: 560
Default Using T-SQL InSERT command to add a new row of data..and printing reports options

Quote:
Originally Posted by brown
I would like it to add a new row to the Booking table in the database, and insert the values inputted..
You basically answered your own question when you used the word "insert".

T-SQL (Microsoft Transact SQL) uses INSERT to add new rows of data to a table,

On the Insert page I linked to above there is a "Best Practices" section and you might want to reading through the part that starts with:
"When you insert rows, consider.."

Generally a common practice is to use the INTO option because if you get into different using other standards of SQL,
besides T-SQL, some "flavors" of SQL consider it optional and some do not.
..or as someone in this StackOverFlow thread puts it:
Quote:
If you always use INTO, you don't need to remember which ones consider it optional. All implementations allow it to be used..

Quote:
Originally Posted by brown
Now all these values have just been collected up as variables and placed in labels at the moment for printing.
It should be noted (for others who might read this thread later) that a more standard implementation
is to use a DataGridView control, binding it to a datatable, which is filled using a data adapter.
That way the datagridview control can serve as the user interface for adding new rows,
or programmatically (in the background) new rows can be added to the datatable (held in memory), which then updates the tables on the datasource.


Re: Data Printing
It should probably also be noted that a frequent task associated with databases is printing reports.
For those who may want to move beyond the basic "place in labels" method there are a number of options.

Fisrt and foremost is using the ReportViewer control.
A good place to start learning what the control can do is: Microsoft.Reporting.WinForms Namespace.

Microsoft basically replaced the old Crystal Reports with SQL Server Reporting Services.
Here is the official MSDN KB article (317789) about that which says:
Quote:
Microsoft only supports setup and installation for the Crystal Reports products that are included in Microsoft Visual Studio .NET 2003,
in Microsoft Visual Studio 2005, and in Microsoft Visual Studio 2008.
All other support is provided by the vendor who developed Crystal Reports, not by Microsoft.
I guess I should say it's not impossible to use Crystal Reports in later versions of VS.Net.
This Codeproject page has some info (and a CrystalReports 13 download link):
Generate a Report using Crystal Reports in Visual Studio 2010



So Microsoft released a migration tool for Crystal Reports, right?
I'm afraid not.
Here's a few links which lists some third party tools if you want to try a migration:
StackOverflow: Easy way for Crystal Reports to MS SQL Server Reporting Services conversion?
..which says:
Quote:
I have searched previously for this, with no luck. There does not seem to be any tools available for this conversion,
the manual method thereby becomes the only method. And yes, there are consulting firms
who will do the manual work for you, but they still do it manually.

Crystal Reports and Reporting Services have different architectural styles, making it a difficult task
for a conversion tool, so I view it as unlikely that someone will build one anytime soon.

I have done several of these conversion projects myself, and there are lots of things
that cannot be automatically converted due to the nature of each product.
Things like expressions, data source information, and dataset queries just cannot be automagically "translated" by a tool.
MSDN Blog: Converting Crystal to Reporting Services

The download links for the SAP VS.Net Crystal Report downloads for VS.Net 2012 are here.



Personally I think both of these options are overkill for most small projects.

A lot of times you can get by using the PrintForm control from the free VB.Net PowerPack (which includes print preview capability built-in).

The other option "print and display print previews in VB .NET" is on this vbHelper page.

Last edited by hDC_0; 02-09-2013 at 03:27 PM.
Reply With Quote
  #3  
Old 02-09-2013, 03:26 PM
brown brown is offline
Freshman
 
Join Date: Jan 2013
Posts: 39
Default

Sorry im still not sure what to do here.

Essentially I have some text boxes that I need to take the information from and store it into the database. im just not sure of the code I would use

sorry
Reply With Quote
  #4  
Old 02-09-2013, 03:40 PM
hDC_0Add record to access database hDC_0 is offline
Contributor

* Expert *
 
Join Date: Feb 2004
Posts: 560
Default Using Insert command - some other code to look at..

Did you even look at the Insert command page I linked to above?

There's a whole bunch of actual VB.Net sample code if you scroll down the page.

If you take a look at this VB.Net code this StackOverFlow page it should be simple enough to understand:
Inserting data into a MySQL table using VB.NET.

It's basically just using Text property of labels instead of the Text property of textboxes.

A quick search found this xvbt thread where a label is used with an Insert statement.

Last edited by hDC_0; 02-09-2013 at 03:49 PM.
Reply With Quote
  #5  
Old 02-10-2013, 03:48 AM
brown brown is offline
Freshman
 
Join Date: Jan 2013
Posts: 39
Default

I did look at it, I just didn't understand it, I called it a day and looked again this morning and now its sorted.

Thanks mate
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Add record to access database
Add record to access database
Add record to access database Add record to access database
Add record to access database
Add record to access database
Add record to access database Add record to access database Add record to access database Add record to access database Add record to access database Add record to access database Add record to access database
Add record to access database
Add record to access database
 
Add record to access database
Add record to access database
 
-->