|
I have multiple datasets accessing the same info in the DB. I did this to be able to select specific records based on certain criteria. When I update info in one dataset I get errors about matching records when my dataset.update is called. I am assuming this is because there is conflicting information in another dataset that I am not updating??? Should I be using multiple sql queries on 1 dataset to accomplish the same thing, or is there code I can write that would update all datasets at the same time?
|
|
|
|
|
Okay, this is just too horrible to even want to try and steer in the right direction.
So let's take one BIG step back:
The DataSet is (in a sense) an interface between your logic (code), your data(base) and your GUI. It is NOT a filter.
The basic sequence of events is thus:
1. A query gets the required data from the database. This should already filter as much as possible.
2. The returned result is stored in a (single) dataset.
3. You connect the dataset to your GUI. For example a dataview, or a form with text boxes, or something like that.
4. You write code for any necessary filters, you want the user to be able to apply, such that it is only filtered in the GUI.
5. The user edits and/or inserts and/or deletes data in the GUI. These changes are stored in the DataSet
6. When the user is done, you simply call MyDataSet.Update() and Bob's your uncle.
If you are absolutely sure that there really is no other way than using several datasets on a single database table (which really is a very bad idea), you are going to have to look into row states.
Basically, whenever the user makes a change to a row, the dataset changes the rowstate of that row. In other words, when the user deletes a row, the dataset does not actually delete that row, it just sets the RowState of the row to "deleted".
Another approach would be to update a single dataset, then requery the database and compare the next dataset's changes to that, change any rowstates, update that dataset, etc. However this method (i.e. the path you are on right now) will lead you into to deepest and darkest recesses of a logic jungle, that I fear we will not see you return from.
My advice is free, and you may get what you paid for.
|
|
|
|
|
I want to take today's date, and x number of days, and use the result to setup when next call back happens. How do I take datetime.today and add (x) days to it?
|
|
|
|
|
Gee. I'd wish they would describe how such things can be done and make a document of that; they even could call it "documentation" and tell google it may be relevant to some people.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
if you type either "now" or "today" and the period - you'll see functions like adddays,addhours,addminutes,addseconds,etc.
ex dim dt as datetime = now.adddays(5)
as luc said, this is available anywhere to find like google or vb docs..
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
This code works well but it does not allow me to make change on existed record. for example after I made some change on the data and go to save it it won't allow me. it is a duplicate. I want to be able to make change on existed data and still save. any idea!
Private Sub Save_Click()
On Error GoTo Err_Save_Click
'Dim answer As String
Me.AllowEdits = True
SOCSECNO.SetFocus
If IsNull(Me!InputDate) And IsNull(Me!FirstName) And IsNull(Me!LastName) And IsNull(Me!SocSec) And IsNull(Me!CompanyName) Then
MsgBox "All fields on this form are required"
Exit Sub
ElseIf IsNull(Me!InputDate) Then
MsgBox "An Input Date must be added", vbExclamation
Me!InputDate.SetFocus
ElseIf IsNull(Me!FirstName) Then
MsgBox "First name must be added", vbExclamation
Me!FirstName.SetFocus
ElseIf IsNull(Me!LastName) Then
MsgBox "A Last name must be added", vbExclamation
Me!LastName.SetFocus
ElseIf IsNull(Me!SocSec) Then
MsgBox "A Four Digit SS# must be added", vbExclamation
Me!SocSec.SetFocus
ElseIf IsNull(Me!CompanyName) Then
MsgBox "A Company Name must be added", vbExclamation
Me!CompanyName.SetFocus
ElseIf DCount("*", "[NOC]", "[LastName]= '" & Me![LastName] & "' And [FirstName] = '" & Me![FirstName] & "' And [SocSec] = '" & Me![SocSec] & "'") > 0 Then
Beep
MsgBox "This first and last name already exists in the database. Please check that you are not entering a duplicate constituent before continuing.", vbOKOnly, "Duplicate Value"
Cancel = True
Else
'ElseIf Form.Dirty = True Then DoCmd.RunCommand acCmdSaveRecord
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
MsgBox "Record is asved!"
End If
|
|
|
|
|
You should have another stored procedure that updates existing records based on their ID. It appears as though you're calling a stored procedure that creates new records, thereby trying to duplicate existing information.
|
|
|
|
|
I am new with vb.
can you give me an example please?
|
|
|
|
|
I am trying to use version 4.1.2 of the itextsharp dll. I have some PDF files provided to me with Optional Content Groups (or layers). The layer names are known. I need to be able to set the layers on or off and then flatten the PDF, so the output pdf has the final state visible, but not changeable.
I have found multiple examples of adding layers using the PDFWriter interface, but none that address my issue.
|
|
|
|
|
Your question is specific to iTextSharp. I've never used it myself, and frankly, questions specific to libraries should be directed at the people who wrote the libraries. For iTextSharp, that should be here[^].
|
|
|
|
|
I am sorry if this post was misplaced. I did attempt on the board you referred to. I did not see anything in the FAQ that indicated the message board(s) were limited to language speciffic requests, and did not see another message board here that would be more appropriate.
|
|
|
|
|
It's not that it's not a "language specific" issue. The problem is that around here, you'll find so few people who have used the library, that your post will have fallen pages and pages behind the current posts before anyone who HAS used it sees your post. The best place to get help on a specific library is the people who wrote the library or forums dedicated to it's use. That's where you're going to find the most people that know about it.
|
|
|
|
|
I agree, just hoping I guess. Thanks for replying.
|
|
|
|
|
Hi
I've created a user control with one text box, one list box and one command button. It acts like a multi selection combo box. I've put it in a Frame. Problem is when I click on the button list box gets hidden and does not show up properly. While windows combo box displays properly irrepective of the place where we put it on. I've tried windows API function BringWindowToTop, but it didnot work either.
Please suggest any way to keep the list box on top and display it fully.
Thanks in advance
Don't Quit
|
|
|
|
|
Hi All,
I am selecting weight
Select instanceid2400,CAST(weight as real) as GrossWeight from tblcargo where instanceid2400='#AGE019000016'
and result is 3289.154
but when I am reading it in vb.net as
Dim GrossWeight as Single
GrossWeight = .GetFloat("GrossWeight")
it is changing value to 3289.1
and when i am using
Dim GrossWeight as Double
GrossWeight = .GetFloat("GrossWeight")
it is putting unwanted values at end 3289.15405273438
how can we show same value (3289.154) whatever is selected
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
modified on Friday, May 15, 2009 9:36 AM
|
|
|
|
|
Change the Single to Decimal...
|
|
|
|
|
And if still facing trouble use .ToString("0.000") ..
Motivation is the key to software development.
|
|
|
|
|
Wrong. The value he's getting is because of the conversion from one floating point format to another. Formatting it to hide the inaccuracies does nothing when the value is used in calculations.
|
|
|
|
|
Ankit Aneja wrote: show same value
I didn't mean to do this (.ToString) during the calculations, but after the calculations, only for showing the correct number (which in fact is wrong, I see that)
Motivation is the key to software development.
|
|
|
|
|
Hi..
how r u ????
I have Q in Vb plz help me as soon as possible becoz i have 2 submit it
The Q is follwing:
Write a program that allows the user to draw 'free-hand' images with the mouse in a PictureBox. Be sure to provide the following:
1. A Button to allow users to clear the image in the PictureBox
2. A ListBox to allow users to change the colour of the pen. Provide few options for colour.
3. A way (radio or list) to set the drawing width. Provide few options for the width.
Be sure that when the user makes a selection from the menu, the appropriate control is updated to reflect the user's choice of colour and width.
Important Note: You will need to use some of the mouse events. In particular the mouse move event should contain your drawing rather than the paint event of the picture box.
RGDS
laila_B
|
|
|
|
|
This isn't a site where people do your homework for you. Do the work yourself, and if you have a specific question come back and ask it.
Scott
|
|
|
|
|
Thanx dear 4 replay but I am not wait smbody 2 do the work 4 me i am tryiny but the problme is when i run the form i drow in form it self not in picture box the follwing is code if u can help me
Public Class form2
Dim shouldpaint As Boolean = True
Dim paintcolor As Color
Dim paintwidth As Integer = 5
Dim drawpen As Pen
Dim paintline As New System.Drawing.Drawing2D.GraphicsPath()
Private Sub Picturedrowing_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Picturedrowing.Click
End Sub
Private Sub Picturedrowing_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Picturedrowing.MouseDown
shouldpaint = True
End Sub
Private Sub Picturedrowing_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Picturedrowing.MouseMove
If (shouldpaint) Then
Dim g As Graphics = CreateGraphics()
g.FillEllipse(New SolidBrush(Color.Red), e.X, e.Y, 30, 30)
g.Dispose()
End If
End Sub
Private Sub Picturedrowing_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Picturedrowing.MouseUp
shouldpaint = False
End Sub
Private Sub form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub lstwidth_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstwidth.SelectedIndexChanged
If Me.lstwidth.SelectedIndex = 0 Then
paintwidth = 5
ElseIf Me.lstwidth.SelectedIndex = 1 Then
paintwidth = 10
'using if statment to select diffrent width
ElseIf Me.lstwidth.SelectedIndex = 2 Then
paintwidth = 15
'ElseIf Me.lstwidth.SelectedIndex = 3 Then
' paintwidth = 16
End If
End Sub
Private Sub lstcolor_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstcolor.SelectedIndexChanged
'using if statment to select diffrent color
If Me.lstcolor.SelectedIndex = 0 Then
paintcolor = (System.Drawing.Color.Brown)
ElseIf Me.lstcolor.SelectedIndex = 1 Then
'using if statment to select diffrent color
paintcolor = (System.Drawing.Color.Blue)
ElseIf Me.lstcolor.SelectedIndex = 2 Then
paintcolor = (System.Drawing.Color.Red)
ElseIf Me.lstcolor.SelectedIndex = 3 Then
paintcolor = (System.Drawing.Color.Azure)
End If
End Sub
Private Sub Picturedrowing_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Picturedrowing.Paint
'Dim move = New Pen(Color.FromArgb(100, paintcolor), paintwidth)
'e.Graphics.DrawPath(move, paintline)
End Sub
Private Sub btnclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclear.Click
Me.Picturedrowing.Refresh()
End Sub
Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexit.Click
Me.Close()
End Sub
End Class
|
|
|
|
|
Hi,
you are looking for somebody to do your work?
Regards: Didi
|
|
|
|
|
hi,
m am good. Sorry, kan't help coz I have 2 do reel prg'ing werk todo.
u should do ur werk prior to posting here. Be sur to respond w/ how badly u need the help.
sinc,
J Deez
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I hope like hell that was a sarcastic use of a keyboard because that is one of the most painful posts to read.
Never underestimate the power of human stupidity
RAH
|
|
|
|