|
Hi sir
I'm try to fetch the early date value from my event list using MIN but cannot.
Here my code :
<pre>IBSSCMD.CommandText = "SELECT c.NAME AS NAME,c.cardholderid AS cardholderid, c.EMAIL AS EMAIL,A.PRIORITY, MIN(a.eventdate) AS EVENTDATE " & _
"FROM EVENT a , CARDHOLDER c , COMMCHANNEL h" & _
" WHERE(a.CARDID = c.CARDID And a.CARDHOLDERID = c.CARDHOLDERID)" & _
" AND a.COMMCHANNELID = h.COMMCHANNELID AND a.EVENTDATE >= CAST('TODAY' AS DATE) AND a.EVENTMSG = 'Access Granted' " & _
" AND a.PRIORITY IS NULL " & _
"group by c.NAME,c.cardholderid,c.email,A.PRIORITY ;"
After select I will update rows for Flag :
<pre> Dim FBCMD As New FbCommand
FBCMD = New FbCommand(" UPDATE EVENT SET PRIORITY='1' " & _
"WHERE CARDHOLDERID ='" + IBSSDR.Item("CARDHOLDERID") + "' " & _
"AND EVENTDATE >= CAST('TODAY' AS DATE) " & _
"AND EVENTMSG = 'Access Granted'", IBSSCN)
Using Console Application, the problem is when running / repeating the command, the result still get the lastest eventdate not MIn(eventdate).
anyone can teach n guide me?
Tq
|
|
|
|
|
|
ok tq sir, this not sql injection, tq for support
|
|
|
|
|
Yes it is. You are concatenating a parameter value directly into the query string.
If you think it's not a SQL Injection vulnerability, then you haven't understood what SQL Injection is, nor how dangerous it is.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Although you're using VB.Net, this is not a VB.Net question. Suggest you post under Database & Sysadmin / Database as your issue is with SQL. You should also give us some idea as to what IBSSDR may contain (presumably a datareader from another query), and probably the table definitions and example data too. For instance, will your query (IBSSCMD) be returning a single row or multiple rows?
|
|
|
|
|
You're selecting where a.PRIORITY IS NULL and also grouping on PRIORITY. Code smell.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hi guys, I just need a little help in retrieving date value from database.
The format of date in date field is "2015-07-03 00:00:00.000"
but when I retrieve it the format automatically change into "07/03/2015 12:00:00"
How can I retrieve the date value as is? I'm using vb.net. Thanks in advance for the help.
|
|
|
|
|
The date value stored in database does NOT depend on the date format used in your system.
So the text "07/03/2015 12:00:00" is not what you "retrieve" but it is what displayed is.
|
|
|
|
|
Then how can I retrieve the same date format value in my database upon retrieval Sir? I am using "Select * From Tablename" query and Tablename can be change depends on what table was selected by user.
|
|
|
|
|
You don't. The date is formatted not on retrieval from the database but on display to the user in your UI.
|
|
|
|
|
Since we cannot see your code it is impossible to guess what is happening. But it could be that you are not formatting the text in the correct way.
|
|
|
|
|
Here is my code:
Dim xTable As New DataTable
Using conn As New SqlConnection(ConnString1.Text)
conn.Open()
Dim TableName As String = DgvTable1.CurrentRow.Cells(0).Value
Dim command As New SqlCommand("Select * From " & TableName, conn)
Dim da As New SqlDataAdapter
da.SelectCommand = command
da.Fill(xTable)
End Using
|
|
|
|
|
Where is the code that displays the date?
|
|
|
|
|
There is no code on displaying the date, I just saw the format of the retrieved date value during Break (F9).
|
|
|
|
|
Sorry, but that has no bearing. The debugger will display dates in the default format.
|
|
|
|
|
Again, date values only get a format when displayed to the user. In this case, the user is you and the UI is the visualizer in the debugger. The visualizer will use the date format specification for your country settings in Windows.
Dates in the database do not have a format.
|
|
|
|
|
Hi
I have working code that shows a dialog box to pick an Outlook email folder.
I always choose the same folder - "\\Shared\Updates" - can someone tell me how to assign the correct value to olfolder please?
Your assistance greatly appreciated.
Dim olfolder As Outlook.MAPIFolder
olfolder = objOL.GetNamespace("MAPI").PickFolder
|
|
|
|
|
Not entirely sure but seems you are looking for how to assign the folders based on need. Following two links would help:
Folder.Items property (Outlook) | Microsoft Docs
OlDefaultFolders enumeration (Outlook) | Microsoft Docs
Based on the folder needed, you can set/assign and use:
Sub ContactDateCheck()
Dim myNamespace As Outlook.NameSpace
Dim myContacts As Outlook.Items
Dim myItems As Outlook.Items
Dim myItem As Object
Set myNamespace = Application.GetNamespace("MAPI")
Set myContacts = myNamespace.GetDefaultFolder(olFolderContacts).Items
Set myItems = myContacts.Restrict("[LastModificationTime] > '01/1/2003'")
For Each myItem In myItems
If (myItem.Class = olContact) Then
MsgBox myItem.FullName & ": " & myItem.LastModificationTime
End If
Next
End Sub
|
|
|
|
|
Not quite what I am after.
I know in advance which subfolder I need - it's always the same one, so having to select it from a list of all folders and subfolders seems silly.
I need a way of specifying one subfolder without
olfolder = objOL.GetNamespace("MAPI").PickFolder
|
|
|
|
|
And I solved it - for any one who is interested here is the solution
<pre>Dim olfolder As Outlook.MAPIFolder
olfolder = objNS.Folders("Membership").Folders("Updates")
myItems = olfolder.Items
Thanks for help
|
|
|
|
|
DEAR ALL,
I NEED A CODE FOR MANAGE STOCK BALANCE REPORT
EXAMPLE:
DATE ITEM CODE ITEM NAME QTY STOCK BALANCE
01/09/2020 1001 ITEM-1 100 100
02/09/2020 1001 ITEM-1 20 120
02/09/2020 1002 ITEM-2 110 110
03/09/2020 1001 ITEM-1 20 140
THIS TYPE OF MY DATATABLE IN MICROSOFT ACCESS
SO I WANT TO AUTO CALCULATE STOCK BALANCE LIKE ITEM-1 PURCHASE IN DIFFERENT DATES AND CALCULATE STOCK BALANCE OF ITEM-1
AND IN SAME TABLE I MANAGE OTHER ITEMS BALANCE ALSO
SO I WANT CODING ITEMWISE
THANKS
|
|
|
|
|
Sorry, this site does not provide code to order; try freelancer.com.
|
|
|
|
|
THANKS FOR YOUR SUGGESTION GOOD BYE
|
|
|
|
|
Typing everything is all CAPS is seen as screaming whatever you're saying. Don't do it.
The only code you're going to get is the code you write. Nobody is going to do your work for you.
|
|
|
|
|
Are you ready? Here's the code: G-53
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|