|
Is the primary Key something generated by them?
does the primary key have a certain construction?
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
Yes Primary Key Is Generated By Our Store Procedure
Yes
|
|
|
|
|
But does it use some sort of business logic to create it?
i.e. (made up example)
Username = simonwhale
date registered = 30/09/13
primarykey = SE300913
or is it a incremented key?
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
ya also used business logic
i.e 2010090001
WHERE 2010 IS YEAR 09 IS MONTH 0001 IS INCREMENTED KEY
But in case of multiple user are click on save button that time generate primary key duplicate error
i want to response that request one by one by queue manner
|
|
|
|
|
There's your problem. Your key generation is not unique enough.
I would have a read of this and see if it helps you
Create A Custom Identity Column (Revision Based Database)[^]
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
modified 30-Sep-13 9:02am.
|
|
|
|
|
Simon_Whale wrote: Your key generation is not unique enough. That was a good hunt, but sounds like you shot the wrong one; sounds more like a concurrency problem than "not being unique enough". The sequence would be unique "enough", but concurrency-problems (a non-atomic operation) might cause the same number to be presented again.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Good point Eddy
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
I would like to know if anyone can give me an example of how to copy text underneath an external program's context menu.
I am playing around with code for basic mouse gestures. When I perform, for example an upwards movement with the right mouse button held in, my program send Ctrl+C to copy whatever is selected when I release the right mouse button. However, lets say I am trying to copy text selected in notepad, If I release the right mouse button over the notepad window, notepad pops up its context menu before my copy command can execute.
You can simulate this by selecting text in notepad, right click and while the contect menu is showing, try pressing ctrl+c.
I am looking for a way to copy what is selected in the foreground window without having to close the context menu. The reason I don't want to close the context menu is that at times you might actually need it, like when you right-click and drag a file in explorer. If my program would esc the context menu then explorer won't pop up a context menu to move or copy the file to where you dragged it.
I hope this makes sense.
Anyone?
|
|
|
|
|
Craig Haywood wrote: selecting text in notepad, right click and while the contect menu is showing,
try pressing ctrl+c
With the context menu open, moving the pointer to "copy" does the same thing ... what is on clipboard ... arghh (brain frozen)
What are you trying to do? Better question, what VB.NET tools do you have available to you to use as a programming platform?
Are you refering to some sort of macro recorder by any chance. Recording mouse movement and behavioral clicks based upon what's on the screen for playback as a mouse behavior repeat in an overlay scenario?
There's this:
Writing a Macro Recorder/Player using Win32 Journal Hooks[^]
|
|
|
|
|
RedDk wrote: With the context menu open, moving the pointer to "copy" does the same thing
I can't programatically move the pointer as not all programs context menus will have the copy command at the same place.
What do you mean what VB.net tools do I have? I use visual studio 2012
|
|
|
|
|
"Underneath"?
What is underneath? Some sort of new technical term for "directly south"? I'm sorry, that was too facetious. Can't help you.
|
|
|
|
|
sorry, english is not my first language. I meant whatever is selected under the context menu
|
|
|
|
|
You cannot capture text just by moving the mouse over a window that belongs to a different application. As soon as you do that all mouse messages will be sent to the owner of that window, which in this case, is Notepad.
Veni, vidi, abiit domum
|
|
|
|
|
thanks to everybody who replied. I found a solution to the problem
|
|
|
|
|
would you share it with us?
|
|
|
|
|
I ended using a global mouse hook to perform (and draw) mouse gestures. That way I can call my own procedures when the right mouse button down/up event is fired
|
|
|
|
|
please help
|
|
|
|
|
Boy, doing this[^] was really hard.
|
|
|
|
|
Hi everyone, I'm in need of a bit of guidance. I'm working on a little weather app and I'm got it all pretty much done. The app gets the local weather by zip code which the user inputs into a textbox. What I would like to do is have the app check the submitted zip code against a list of valid zip codes. Now, I have the list of zip codes and there are honestly more than I thought(approx. 43,180). I tried to hard code a string array with the zip codes but that caused visual studio to get too sluggish to use. Does anyone have any ideas on how I could check the users zip against the list of zip codes, or could you point me in the right direction? Thanks for any and all help.
Oh yeah, I forgot to mention I'm using vb.net.
|
|
|
|
|
|
Database to hold the data and possibly a ComboBox or TextBox, using AutoComplete, depending on your requirements.
|
|
|
|
|
There is something called a HybridDictionary .
Its optimized for performance and could resolve your issue by directly accessing the appropriate zip code.
|
|
|
|
|
|
Thanks guys. It looks like a database is the way to go.
|
|
|
|
|
Hi all,
I have made a datagridview textbox cell autocomplete. Now I want to get the values in the other cell associated with the autocomplete textbox cell from the database.
Like I have 4 Columns in my datagridview.
Col0 is ProductId (Primary Key)
Col1 is ProductName (Autocomplete)
Col2 is AvailableQty
Col3 is Rate
When I select the product from Col1 by Up or Down key, the other column cells would populate the data associated with the productname(Col1) from the database.
My question is how would I do that ?
I tried...
Private Sub DataGridView1_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged
If DataGridView1.CurrentCell.Value Is Nothing Then
Else
Try
OpenConnection()
Dim Sb1 As New StringBuilder
Sb1.Append("SELECT * FROM stockitems WHERE ProductName='" & Me.DataGridView1.CurrentRow.Cells(1).Value & "'")
Dim dbcommand As New MySqlCommand
dbcommand.Connection = conn
dbcommand.CommandText = Sb1.ToString
Dim dbread As MySqlDataReader = dbcommand.ExecuteReader
While dbread.Read
DataGridView1.CurrentRow.Cells(0) = dbread("ProductId")
DataGridView1.CurrentRow.Cells(2) = dbread("AvailableQty")
DataGridView1.CurrentRow.Cells(3) = dbread("Rate")
End While
dbread.Close()
Catch ex As Exception
MsgBox(ex.Message)
Finally
CloseConnection()
End Try
End If
End Sub
But nothing happened.
Then I tried...
Private Sub DataGridView1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGridView1.KeyDown
If e.KeyCode = Keys.Down Then
Try
OpenConnection()
Dim Sb1 As New StringBuilder
Sb1.Append("SELECT * FROM stockitems WHERE ProductName='" & Me.DataGridView1.CurrentRow.Cells(1).Value & "'")
Dim dbcommand As New MySqlCommand
dbcommand.Connection = conn
dbcommand.CommandText = Sb1.ToString
Dim dbread As MySqlDataReader = dbcommand.ExecuteReader
While dbread.Read
DataGridView1.CurrentRow.Cells(0) = dbread("ProductId")
DataGridView1.CurrentRow.Cells(2) = dbread("AvailableQty")
DataGridView1.CurrentRow.Cells(3) = dbread("Rate")
End While
dbread.Close()
Catch ex As Exception
MsgBox(ex.Message)
Finally
CloseConnection()
End Try
End If
End Sub
But I failed.
Please help...
|
|
|
|