Sorry, this always seems to happen after I post but I think I get it now. I'm trying to assign a value to a class. It compiles if i do this:
Private Sub ab(Optional ByVal val As EncryptKey = Nothing)
I was confused by this:
Private Sub ab(Optional ByVal val As String = "")
I don't know how String is defined to be able to accept this but what I'm doing won't work.
Sorry again for the ugly post.
Sorry about the subject line; didn't know how to describe my problem.
Through searching around the internet i've come up with this class to be able to process a string value.
Private _string As String = String.Empty
Public Sub New(ByVal value As String)
' Remove white space
Me._string = value.Trim()
Public Shared Widening Operator CType(ByVal value As String) As EncryptKey
Return New EncryptKey(value)
Public Overrides Function ToString() As String
Public Function Length() As Integer
Public Function IsEmpty() As Boolean
Return (_string.Length = 0)
Public Shared Operator +(ByVal s1 As EncryptKey, ByVal s2 As EncryptKey) As EncryptKey
' Concat and remove white space
Dim temp As String = (s1._string + s2._string).Trim()
Return New EncryptKey(temp)
The class is working except for this case:
Private Sub ab(Optional ByVal val As EncryptKey = "")
' Results in this error for the Optional assigment:
'error BC30060: Conversion from 'String' to 'EncryptKey' cannot occur in a constant expression.
Is there a way to make the class able to accept this assignment as an Optional parameter?
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 ;"
Using FBCMD AsNew FbCommand("UPDATE EVENT SET PRIORITY = '1' WHERE CARDHOLDERID = @CARDHOLDERID AND EVENTDATE >= CAST('TODAY' AS DATE) AND EVENTMSG = 'Access Granted'", IBSSCN)
"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?
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.
Dim xTable As New DataTable
Using conn As New SqlConnection(ConnString1.Text)
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
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.
Based on the folder needed, you can set/assign and use:
Dim myNamespace As Outlook.NameSpaceDim myContacts As Outlook.Items
Dim myItems As Outlook.Items
Dim myItem AsObjectSet myNamespace = Application.GetNamespace("MAPI")
Set myContacts = myNamespace.GetDefaultFolder(olFolderContacts).Items
Set myItems = myContacts.Restrict("[LastModificationTime] > '01/1/2003'")
ForEach myItem In myItems
If (myItem.Class = olContact) Then
MsgBox myItem.FullName & ": " & myItem.LastModificationTime
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
Last Visit: 31-Dec-99 18:00 Last Update: 25-Sep-23 8:02