Auto-generate - Updating Function - Hospital System Which Works With A Access Database ?
Jun 21, 2010
I am using vb to make a hospital system which works with a access database. i am having an issue with the updating function to the database, this time round instead of hard codding the connection i used the connection/data source wizard, in microsoft visual studio 2008 and there fore most of the code has been auto generated for me, which includes the insert, delete and update funtions from what i can find and what i have read vb is ment to also auto generate this which it is not. the funny thing is that i can close the program down and reload it (as long as i haven't opened the database) and my changes are still there but if i go and open the database and it hasn't changed. also i can change the database through the use of the Dataset connections in the datasource tab but not int he program the code ive found and believe that is meant to update the database
This is running off a couple of buttons i also have a update query but have know way of accessing it
Me.Validate()
Me.TblPatientDetailsBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.PatientInfoDataSet)
View 1 Replies
ADVERTISEMENT
Nov 13, 2011
'Declare the price rate per night
Const decNightly_Rate As Decimal = 350D
Private Sub btnCalculateCharges_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculateCharges.Click
[code]...
I am trying to make a hospital form where the user inputs data for a hospital bill. I have to create three functions: CalcStayCharges, CalcMiscCharges, and CalcTotalCharges. I do not know why this code won't work.
View 13 Replies
Feb 24, 2012
I am currently facing an heavy struggle with architecturing my VB.Net app.To simplify, i'm using entries from XAML comboboxs, which all trigger OnChange the same routine which manages which Function(s) to use depending on which combobox triggered.The problem i'm facing is for example i have Function(ByVal A As String, ByVal B As Integer, ByVal C as Double, etc...), and it works if the routine calls explicitly for this function's result. But then if another combobox makes for example the variable B to change, then i have to add another "If sender= Then" check for this combobox and recall expicitly the function above (since B is one of its parameters)..In the end, my routine is loooooong like 24 checks with at least 4x duplicates of same functions..is there a simple way to make a Function autoexecute when one of its parameters change without having to be called explicitly by another routine ? (Like Excel formulas do when one of its references change)
View 12 Replies
May 3, 2009
I am coming from VB6 and I am starting to convert an existing VB6 code to VB.Net. What tools can I use to automate this task?
View 3 Replies
Jan 27, 2012
I would like to generate a tracking number as primary key for my database.
There will be total 12 letters for each tracking id. Example: 2012010001-1
The "2012010001-1" is actually from combination YYYYMMxxxx-v where YYYY is the current year, MM is the current month, xxxx is the auto generate number(increment) and -v is the version where it can be -2 -3 but using the same YYYYMMxxxx.
For both YYYYMM is not a prob as i can get the value from Date.Today.Month/Date.Today.Year. But how am I going to ensure the xxxx is an auto increment but will be reset back to 0000 every new month.
For example:
2012010000-1 (Month January, so start from 0000)
2012010001-1
2012010002-1
[Code].....
View 1 Replies
Feb 22, 2009
I created a access table with three fields, CustomerID, FirstName, LastNameI set the CustomerID field to the primary key and the type of AutonumberIn my VB app I dragged the three fields over to my form.I clicked on the plus sign at the top and it displayed -1 in the customer field, I entered a First Name and a Last Name and press the save button. I repeated the process 2 more times and the CustomerID field went from -2 to -3.I looked at my table in acces and all three records showed 1, 2 & 3 as it should. When I exited the form and then open the form again it shows record numbers 1, 2 & 3 as it should.How come it takes exiting the form and then back in to see the correct CustomerID's ?
View 4 Replies
Jul 1, 2011
I have created a setup using INNO which puts a Visual Basic 2010 Express program on the computer to update an Access database. It works on my Windows XP computer. On the user's computer, which is a Windows 7 computer, the Access database comes up as Read Only when opened. I get an "Operation must use an updateable query" error in the Visual Basic program when I try to create a record. The database has Read Only checked off in it's properties. But when you open it in Access 2010, it says Read Only at the top. (This computer has Access 2010. The database itself is in 2002-2003 format.) How can I get this database to be updateable on the user's computer? It works on my computer/does not say Read Only when opened in Access 2007.
View 3 Replies
Jul 8, 2010
I've created a small DLL, an addin for Autodesk Inventor, this addin saves some information provided by the user and the program to an access(mdb)database.The whole idea behind this is that it allows users to quickly find drawings, assemblies and so on.The DLL works great on x86 systems however it has issues on x64 because I used ado.net.In a attempt to solve it I forced .net to compile it with the target x86 CPU settings.
However using this I'm unable register the dll (C:WINDOWSMicrosoft.NETFramework64v2.0.50727RegAsm.exe /codebase SavetoDatabase.dll )It says its not a proper .net dll file and therefore cannot be registered.
is there any other access-database connection provider (like dao or ado.net) that works on a 64 bit machine? Or do I need to change from mdb databases to another type (like mysql)? because sooner or later all machines its running on will be converted to x64.Or do I need to register the dll in another way?I've also tried to replace the conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0 with ACE, with no luck however
View 1 Replies
Aug 31, 2009
I am trying to generate an excel report where the data is coming from access database using VB.
View 2 Replies
Jun 22, 2010
I am trying to generate random images from access database using hashset as it is said to be unique and there won't be any repeated images appearing. But, it doesn't seem to work.
How can i get it to work? By the way, i am very new to the concept of hashset.
Private Function GetImageFromByteArray(ByVal picData As Byte()) As Image
If picData Is Nothing Then
Return Nothing
End If
' is this is an embedded object?
Dim bmData As Integer = If((picData(0) = 21 AndAlso picData(1) = 28), 78, 0)
' load the picture
Dim img As Image = Nothing
Try
Dim ms As New MemoryStream(picData, bmData, picData.Length - bmData)
img = Image.FromStream(ms)
Catch
End Try
' return what we got
Return img
End Function
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Panel1.Visible = False
Panel2.Hide()
Dim conn As New OleDbConnection
Dim DA As OleDbDataAdapter
Dim DS As New DataSet
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db1.mdb;User Id=admin;Password=;"
DA = New OleDbDataAdapter("Select Empty, EmptyName, Target, TargetName from PicturesDisplayed", conn)
DA.Fill(DS)
Me.PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
Dim oledbconnection As OleDbConnection
oledbconnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Documents and SettingsAdministratorDesktopdb1.mdb;Jet OLEDB:System Database=system.mdw;")
oledbconnection.Open()
Dim command As OleDbCommand
command = New OleDbCommand("select count (*) from PicturesDisplayed", oledbconnection)
Dim count As Integer
count = command.ExecuteScalar()
oledbconnection.Close()
Dim randomImage As New HashSet(Of Integer)
' Create a integer and new Random object
Dim intPic As Integer
Dim rand As New Random
'Pick a random number between 0 and the number of images in database
intPic = rand.Next(0, count)
randomImage.Add(intPic)
PictureBox1.Height = 256
PictureBox1.Width = 256
PictureBox2.Height = 256
PictureBox2.Width = 256
Dim pic1x As Integer = _
(Me.ClientSize.Width - PictureBox1.Width) 2
Dim pic1y As Integer = _
(Me.ClientSize.Height - PictureBox1.Height) 2
PictureBox1.Location = New Point(pic1x, pic1y)
Dim pic2x As Integer = _
(Me.ClientSize.Width - PictureBox2.Width) 2
Dim pic2y As Integer = _
(Me.ClientSize.Height - PictureBox2.Height) 2
PictureBox2.Location = New Point(pic2x, pic2y)
' Now set the picturebox image equal to the image chosen from the array randomly using the random
PictureBox1.Image = GetImageFromByteArray(DS.Tables(0).Rows.Item(intPic).Item(0))
PictureBox1.Visible = True
PictureBox2.Image = GetImageFromByteArray(DS.Tables(0).Rows.Item(intPic).Item(2))
PictureBox2.Visible = False
If (randomImage.Count = count) Then
Me.Close()
End If
End Sub
View 1 Replies
Apr 2, 2010
I'm having problems updating my existing access database in vb. Whenever I exit my program, the changes made won't save. How can I correct this? This is the code I have so far...
Code:
Private Sub Customer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'AutioEssentialsDataSet3.Customer' table. You can move, or remove it, as needed.
Me.CustomerTableAdapter2.Fill(Me.AutioEssentialsDataSet3.Customer)
[code].....
View 4 Replies
May 14, 2009
I wrote this code in asp.net(vb):
dim dbconn as New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & server.mappath("../kri1.mdb")) Dim DBCmd As New OleDbCommand Dim DBAdap As New OleDbDataAdapter DBCmd = New oledbCommand("INSERT INTO tabela (@id, @nesto, @ime)", DBConn) DBCmd.Parameters.Add("@ID", OleDbType.smallint).value= 6 DBCmd.Parameters.Add("@nesto", OleDbType.varchar ).Value = "2" DBCmd.Parameters.Add("@ime", OleDbType.varchar ).Value = "3" DBCmd.Connection.Open() DBCmd.ExecuteNonQuery()
and nothing happened in my database and there's no compilation error?
View 1 Replies
Jul 13, 2011
I have a access database named login.mdb,which has many tables.i want to update table named "try".in tat table i have two fields viz name and rollnumber.i want to update rollnum of corresponding name.[code]...
View 2 Replies
Jan 27, 2012
I have taken over support of a VB .Net application that makes use of an Access database. Now I discover that the developer who wrote this application did not create any unique indexes on the primary key columns for the tables in the database. So none of the primary key fields are actually flagged as being primary keys in access and so no duplicate checking is being performed by Access. Furthermore, the primary key columns are not being auto-incremented with an AutoNumber type in Access, rather the developer has used queries like this to insert rows into the tables:
INSERT INTO Users (pkid, FirstName, Surname, City)SELECT iif(isnull(max(pkid)),0,max(pkid))+1, [@strFirstName], [@strSurname], [@strCity], FROM Users;This application is generally run as a networked application with up to 40 people using the application simultaneously, and combined with design issues already mentioned, this has resulted in serious concurrency issues with several users being assigned the same primary key value. This == BIGNow I need to sort this out (guess what I will be doing this weekend!! Great.). I have thought about maybe using a mutex around the code that calls the Access insert queries; not the neatest of solutions, but it would be the quickest. Ultimately though, I would like to have the database corrected and have proper primary key values in place. But the application is currently running at about 15 different sites, so I need to do some sort of batch update of the database.
View 3 Replies
Apr 21, 2012
i am trying to update the info in my access database and i keep getting a syntax error. This is my first database program and i found a site online that showed my how to do it but when i get to the update it keeps giving me the syntax error.
Private Sub CreateBT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateBT.Click
Dim con As New OleDb.OleDbConnection
Dim dbProvider As String
[code]....
View 1 Replies
Jan 5, 2010
Here is the error: [URL]
here is my code: what can I do to solve this error
Try
If MessageBox.Show("Save and update database?", _
"Confirmation", MessageBoxButtons.YesNo) = _
[Code]....
View 3 Replies
Aug 23, 2011
This is my code for update event
Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating
Connection.Open()
[Code]....
it is deleting and fetching fine but while trying to update it shows nullreferenceexception was unhandled by user code in this line:
a = Trim(empname.Text.ToString)
View 1 Replies
Mar 11, 2010
I am having a problem updating an access database with new information from an updated dataset. the database consists of 4 columns: User_ID, Login_Name, Password, Access. The following code makes a connection to the database, fills a dataset with the data from the database, reads a txt file with user name and passwords, and should update the dataset and then the database. However, I keep getting an Syntax error on the INSERT INTO statement on the datest.Update(dsUser,"User") line. I have found multiple posts on here showing the correct syntax of how to update a database, but I can't seem to get it to work.
[Code]...
View 1 Replies
Jul 24, 2011
I have been trying to update my database using datagridview control.my code below gets the data from database to datagridview but when i hit the update button ,,i get an oledb exception saying error in insert into statement .
Imports System.Data.OleDb
Public Class Form3
Dim cnxnString As String = ("Provider=Microsoft.JET.OLEDB.4.0;" & _
[Code].....
View 14 Replies
Jun 4, 2009
I've been browsing these forums for a day looking for the answer to this, so far nthing has fitted.I've got an access 2000-2003 database containing a whole pile of data for a VB coded application to use. One of the tables in the database needs to be able to be updated with data from the application.The new data is stored in the app as a datatable. I need to replace the original table in the Access file with the datatable in the App.
I'm changing as many as 60 values at a time, so defining these as parameters in an OleDbCommand would be impractical and frankly ridiculous.
View 2 Replies
Jan 13, 2011
I'm developing a program utilizing an Access database and Visual basic. I'm having a problem saving the data I'm adding to the database. I'm entering the data into the database table with text boxes and making a new row and adding it the the table:Database2DataSet.Tables("").Rows.Add(newRow)
I have a grid view for the table, and the new row is added to the table, showing that I'm getting the new information into the table. However, I'm trying to save this new information to the database so its there after I close the program. I've tried using the following but none have worked so far.
[Code]...
View 1 Replies
Jul 16, 2009
3. DB2, located on a shared network drive, contains nothing more than the structure of DB1, but which I have updated to include new fields in various tables, as well as some new queries and modules.4. I need to be able to copy whatever new table structure there is, etc, without overwriting the user's existing data.
View 3 Replies
Jul 17, 2009
com=new oledbcommand("Select tablename SET Roll=@Roll or Name=@Name or Age=@Age WHERE Roll=@Roll or Name=@Name or Age=@Age")
command.Parameters.AddWithValue("@Name", Combobox1.text)
command.Parameters.AddWithValue("@Age", textbox1.text)
command.Parameters.AddWithValue("@Roll", Combobox2.text)
Is this a correct syntax of updating an access database using parameters?
View 39 Replies
May 25, 2011
I am trying to make changes to parts of an Access table but can not get the database values to change.I am able to get the datasets and things in VS to change, but the database never shows the changes.
I Have:
' Create an instance for the payrolltable
Dim dt As New MsPeachDataSet.PayrollDataTable
[code]......
View 3 Replies
Jul 14, 2010
I got an Syntaxerror in my INSERT INTO but i cant figure out why.
[Code]...
View 3 Replies
Jan 17, 2012
I have part of an application that reads from a database makes changes to the data then saves the changes to the database.
[Code]...
View 1 Replies
Feb 1, 2011
I'm using Access 2010 for 2 small databases for a windows forms desktop application.on Form 1, my datagridview updates Paccounts.mdb correctly as follows:
end_OK:
Try
Me
.PaccountsTableAdapter.Update(PaccountsDataSet.Paccounts)
[code]....
View 3 Replies
Jul 6, 2009
I'm currently looking to add a code where, when executed, finds the appropriate value (searches for it), then on the same line, but in a different category, changes the text to 'YES'.
[Code]...
View 2 Replies
Oct 7, 2011
how to update fields in an Access database through VB. What I'm supposed to do subtract the quantity of the daily orders from the inventory quantity. My textbook is a little bit vague at this point, because the only way it describes updating the DB is manually through the BindingSourceNavigator. I don't want to enter it manually, I want it to subtract the quantity from the orders table.
Public Class frmMicroland
Private Sub frmMicroland_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
[Code].....
View 1 Replies
Mar 11, 2010
:( I am have been trying to update changes from my vb.net program to an access database file and it simply will not work. I have am using table adapters. I'm not familiar with SQL so i can't go that route. It updates the dataset fine but not the database...
I have pasted my code below.
Private Sub BooksBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BooksBindingNavigatorSaveItem.Click
[code]....
View 1 Replies