[2005] Today.date Versus Now Versus DateTime.Now?

Jan 16, 2009

just want to know what is the difference between these date values?Once some one told me that its difference is server date and client date but not sure which one he meant.Below is 3 type of date currently I'm using and don't know what is the difference between them.

DateTime.Now is from System.DateTime.Now
Now is from Microsoft.VisualBasic.DateAndTime
Today.date is also from System.DateTime

View 4 Replies


ADVERTISEMENT

Cardinality Estimation - DateTime Parameters Versus Cast?

May 4, 2011

I am trouble shooting poor performance for the query I have posted below. Here is my problem: If I run the exact query below in sql server management studio or using .NET sqlclient the query takes an average of 14 seconds to run.

However, if in .NET I take out this part of the query:
DECLARE @time_diff INT
DECLARE @start_date DATETIME
DECLARE @end_date DATETIME
SET @time_diff = 2
SET @start_date = '05/04/11 00:00:00 AM'
SET @end_date = '5/4/2011 11:59:59 PM'

And use parameters in code like this:
sqlParameter = sqlCmd.Parameters.Add(New SqlParameter("@start_date", System.Data.SqlDbType.DateTime))
sqlParameter.Value = parameters.StartDate
sqlParameter = sqlCmd.Parameters.Add(New SqlParameter("@end_date", System.Data.SqlDbType.DateTime))
sqlParameter.Value = parameters.EndDate

Then the query takes about 2 - 3 minutes to run. Also, I have noticed that it takes about 2 - 3 minutes to run, if i replace the parameter values with string date constants and run in .NET or SSMS

--AND v.call_start_time BETWEEN @start_date AND @end_date
AND v.call_start_time BETWEEN '05/04/11' AND '5/4/2011 11:59:59 PM'

I found this article [URL] on cardinality and the query optimizer and I think it has to do with my issue but it doesn't seem to make sense in my case. According to the article, casts should be executed when determining cardinality. In my case this doesn't appear to be happening. The article also says to use parameters in place of local variables - which isn't working well with .NET parameters either. Regarding using a stored procedure instead: I have a variable number of parameters, I don't know how well it would work out. Even if this is the only option, then i would still like to know exactly what the problem is.

The query:
DBCC DROPCLEANBUFFERS
DBCC FREEPROCCACHE
SET STATISTICS IO ON
DECLARE @time_diff INT
DECLARE @start_date DATETIME
DECLARE @end_date DATETIME
SET @time_diff = 2
[Code] .....

View 1 Replies

Date Fields In DGV: Stored Versus Displayed?

Feb 2, 2009

how data is stored in a DB vs how it is displayed in a DataGridView, but i cant come up with a solution to my problem ...I have a DGV being filled by a Datatable. I have set the DGV Date column to format as "yyyy-MM-dd" and it shows that accordingly.

DataGridView1.Columns(9).DefaultCellStyle.Format = "yyyy-MM-dd"

I also have a sub that USED to take the DataTable that filled the DGV and used it to generate a CSV file. But since i had modified how the date was displayed in the DGV i decided to change the CSV Export to use the DGV instead of the DataTable.

Dim writer As System.IO.StreamWriter
writer = File.CreateText(PathToSaveFile)
For intRows As Integer = 0 To DGV.Rows.Count - 1

[code]....

My issue is that even though i changed the VIEW in the DGV to show me the date how i want it, the CSV does not take the displayed date when it writes the lines, it seems to still take the DB date, and then displays it as "dd/MM/yyyy". how am i supposed to tell the CSV Sub to change how the date is displayed in this file ?

View 2 Replies

VS 2008 - Default Date Versus Null Field

Aug 26, 2011

I have the following
If Trim(txtConfirmationDate.Text) <> "" Then
sqlinsert2.Parameters.AddWithValue("@CONFIRMDATE", CDate(txtConfirmationDate.Text))
Else
sqlinsert2.Parameters.AddWithValue("@CONFIRMDATE", VB.vbNull)
End If
Unfortunately, it writes "01/01/1900" to the database. How do I get it to just leave the field as NULL?

View 8 Replies

IDE :: VB 2008 Versus 2005?

Sep 1, 2009

I have a book from a friend called "Teach Yourself Visual Basic in 21 Days" and so far what I have read has been very nice and easy to look at as well as understand. It also seems like it will do what it says it will do. One problem is it was published in 2006 so it uses VB Studios 2005. There is a rather large difference between 2005 and the new 2008 Express edition and I see the new 2010 beta so I wondered: "light from above, is it worth looking for the 2005 edition of Visual Basic Studios Express Edition or should I rather just look for another book and start working with this 2008 edition? I really fancy this book on the 2005 edition but seeing as it doesn't even have the XP window styles in the figures it might be a little outdated and this new 2010 edition might blow away 2008! I am so confused. Should I throw out the old and go with the new, or should I work with 2008 until IT'S time is up? Is it worth it in this new economy and fast paced evolving career opportunity?" Well, I didn't get a response form the great Computer Techie in The Sky, so I am asking you... What should I do? I understand that it might be better to learn with this new 2008 edition but even still I would imagine their are some 2005 based programs out there people use that might need updating. As a beginning programmer I don't know where to go.

View 3 Replies

Enter Key Press Event Show How VB 6.0 Versus .NET 2005?

May 30, 2007

How I can hook on my entery tool forms when user press ENTER key to go on next Control which can be any dot.net control which is indexed by TabIndex?My client don't like to use TAB key to jump on next control, they like ENTER as well and we need to refactory all VB 6.0 projects in VB.NET 2005...

Private Sub txtField_KeyPress(Index As Integer, KeyAscii As Integer) If KeyAscii = vbKeyReturn Then
KeyAscii = 0 SendKeys "{TAB}" End If End Sub

Of course above pice of code is just sample code how this is working in VB 6.0... How I can do something like this in VB.NET 2005?

View 3 Replies

.net - X=x+1 Versus X +=1?

Apr 30, 2009

I'm under the impression that these two commands result in the same end, namely incrementing X by 1 but that the latter is probably more efficient.If it is correct, why should the latter be more efficient? Shouldn't they both compile to the same IL?

View 17 Replies

IDE Versus EXE Performance In .NET?

Oct 5, 2009

I've developed a .NET application that, among other things, does the following:Uses WebClient to retrieve data from a remote server.
Serves as a socket server to 2 'satellite' applications run on the same machine or on a LAN.When I run the app in the VS IDE, it works great. It quickly gets the data from the remote server and communicates perfectly with the 2 satellites.However, when I build it and run it as an EXE, the response from the remote server is very slow and its communication with the 2 satellite applications become very poor.Is there some important difference between running an app in the IDE and running it as an EXE that could effect it like this?

View 1 Replies

Objective C Versus .net?

Apr 9, 2011

For every member object I have to declare the variable 3 times.One in the declaration. One for property declaration. One to tell the compiler to synthesize all the function. Another one to release all those members from memory.Then I learn about Core Data. I generate diagram, poof the classes are made from me and a lot of things are done behind the screen of that visible classes.

Basically Core Data in Objective C represents some form of relational databases. Of course those databases can have relationship, including many to many relationship. The additional detail of having a third table for many to many relationship is already done.Then, there is indexed property so we can search faster. That's also done.

View 1 Replies

[2008] WPF Versus GDI?

Jan 12, 2009

I have thought of a new project to keep me busy for a while, and it involves a more advanced GUI, specifically I want to display a map and put objects on it or highlight certain areas for example. I've been searching the forum for a little while and ran into two options for more advanced GUI building: WPF and GDI.

View 2 Replies

.net 2003 Versus Mysql?

Jun 21, 2010

i am not able to use connection string?

View 1 Replies

Application.Exit() Versus End?

Dec 8, 2010

Can anyone tell me what the technical difference is between Application.Exit() and End?Why would you choose to use one over the other, for example?

View 5 Replies

Asp.net - SQL Transactions: TSQL Versus .NET?

Nov 19, 2010

I wanted to know what (if any) differences there are to using the SQL Transaction within the application versus written into the stored procedure using TSQL statement. We would need to restructure the stored procs and vb code to get this to work and I'm not sure it would be worth the effort at this time.

Public Sub RetrieveTData(ByVal cID As String, ByVal cnn As SqlConnection) As Boolean
Dim sqlTran As SqlTransaction
cnn.Open()
sqlTran = cnn.BeginTransaction

[code].....

We aren't certain whether the timeout is occurring in DataAlreadyTransferred() or usp_BigNasty_CopyDataFromDB1toDB2 due to how the try/catch is written. We can restructure this code, but will take a week or so to get it to production (no errors occur on test/dev today)

DB1 - permanent storage, used by other applications as well
DB2 - working set, used only by Web App

DataAlreadyTransferred(cID) first checks to see if DB2 has any copies of the records, if DB2 does and those records are clean it deletes them (data could have changed in DB1 and we want the most up-to-date version). If DB2's data is dirty it is left alone and no data is deleted.

usp_BigNasty_CopyDataFromDB1toDB2 copies rows from approximately 20-30 different tables and copies over the perm copies from DB1 into DB2, essentially creating a working set from which the Web App can access

We are aware this is inefficient and are examining ways to improve it, just haven't had time yet... I believe by having the transactions in the app code it's locking many more tables than is really needed. If we move them to the stored procs, less tables will be locked at one time thus improving our chances of removing deadlock conditions/timeout issues we're seeing today. Just not sure on this..

View 2 Replies

C# - Appropriate To Use Generics Versus Inheritance?

Apr 28, 2009

What are the situations and their associated benefits of using Generics over Inheritance and vice-versa, and how should they be best combined?I'm going to try to state the motivation for this question as best I can:I have a class as shown below:

[Code]...

Now suppose I have a repository that takes an InformationReturn argument, that has to strore different fields in a DB depending on the type of Info object T is. Is it better to create different repositories each for the type T is; one repository that uses reflection to determine the type; or is there a better way using inheritance capabilities over/with generics?

View 6 Replies

C# - Division By Zero: Int Versus Float?

Dec 18, 2010

Deviding an int by zero, will throw an exception, but a float won't - at least in Java. Why a float have an additional NaN info, while int haven't?

View 6 Replies

Case Versus If Then Statements.

Apr 26, 2011

i have a program, three radios, and 2 check boxes. the Radios use a constant value and do a multiplication. check one applies a discount. no problem.

the last takes the values of all three radios does a comaparison and displays a label if false, performs a subtraction if true and shows savings.problem>

very convoluted using if statements. and the output is often wrong(i know this is a logic error) i can not find the fault.

would it be easier to use case statments. can and will post code if requested. as it is in if then format currently it is rather long.
Sometimes the answer is so blindingly obvious i fail to see it.

View 4 Replies

Generics Versus Extensions?

Nov 8, 2009

This is my problem:

<System.Runtime.CompilerServices.Extension()> _
Function CastAs(Of TSource As TTarget, TTarget)(ByVal array As TSource()) As TTarget()
Return Global.System.Array.ConvertAll(array, Function(src As TSource) DirectCast(src, TTarget))
End Function

View 10 Replies

Namespace References In C# Versus .Net?

Aug 22, 2009

In VB.Net you can do something like the following without any issues... just ignore the fact that this is a pretty useless class :-)

Imports System
Public Class Class1
Public Shared Function ArrayToList(ByVal _array() As String) As Collections.Generic.List(Of String)

[code]....

However if you do the same thing in C#...

using System;
public class Class1
{
public static Collections.Generic.List ArrayToList(string[] _array)

[code]....

You will get an error on the line with the return on "Collections.Generic.List" saying "The type or namespace name 'Collections' could not be found (are you missing a using directive or an assembly reference?)"I know that you have to actually have a using directive to System.Collections.Generic to use List but I don't know why. I also don't understand why I don't get the same error in the function declaration, but only in the return statement.

Edit: Just to note, the question is really about the referencing of a sub-namespace such as in the example being able to reference Collections within System.

View 3 Replies

Overloads Versus Overrides In .net?

Oct 24, 2011

What are the behaviors difference for the Previous Property of Other1 and Other2 Class.Note than the return type of the ovrloaded Previous Property of Other2 as bean changed to Other2 while it stay as Base for Other1.

Public Class Base
Private _Previous as Base
Protected Overridable ReadOnly Property Previous As Base

[code]....

View 2 Replies

Reference Versus Instantiate?

Aug 25, 2011

what actually goes on inside the pc when I reference an object vs when I instantiate it.

Like this

Guys joe; (reference)

Joe = new Guys; (instantiate).So what goes on inside the computer for each line above.

View 15 Replies

String Concatenation: Using += Versus &=?

Sep 13, 2010

Possible Duplicate: The difference between + and & for joining strings in VB.Net.In VB.NET you can use either += or &= to concatenante a string (ignoring using a StringBuilder for this question -- this is directed at a very simple concatenation).

View 2 Replies

Structures Versus Classes?

Feb 3, 2011

I've been programming a custom structure to use in my program for a while now and I am debating whether I should switch over to using a class instead. Reason being is because I've read from a few sources that structures should be kept for simple storage of primitive types. However, I am using my structure to store a few integers and a few custom classes of my own.I haven't noticed any slowdowns or performance issues but I do know that I have to update the actual variables in the structures since they are value types and not reference types.

View 5 Replies

Winsock VB6 Versus VB2008?

Jan 3, 2010

i have winsock for vb 2008 and for vb 6 but in 2008 not all commands working like Winsock1.Accept RequestID or more you dont know why ? u know i like more working in vb 2008 this is why im asking if im no have old winsock ? for vb 2008 i have there kollman koding and normal microsoft corporation COM?

View 6 Replies

Winstock Versus System.net?

Aug 7, 2009

I was looking around the forums for how to do a successful Winsock program but noticed that there is an alternative way of creating connections, using system.net.sockets. Would you guys say that system.net.sockets has replaced Winsock?

View 1 Replies

.net - IOS JSON Versus ASPNET Web Services?

Feb 2, 2012

I am stucking this problem for long time.I am developing an IOS which to throw JSON to web service in order to insert into database.But failed to do it.

[Code]...

View 1 Replies

Abstract Class Versus Interface?

Jan 31, 2011

understanding difference between an interface and an abstract class which has no function with implementation?which is better abstract cls or interface in term of speed, features..?

View 11 Replies

Advantages To Using The .NET Like Operator Versus A RegEx?

Jul 19, 2010

Other than perhaps enhanced readability for very simple patterns, why would someone choose to use the Like operator in VB.NET over regular expressions for string pattern matching? Are there any advantages?

View 1 Replies

C# - System.IO Versus VisualBasic.FileIO?

Aug 22, 2009

I typically develop in C# and am quite accustom to using System.IO. I recently ran across the FileIO library and have found that some of the advantages (such as sending an item to the recycle bin) are quite nice to have. Especially in the program I am currently working on.My question is, Does System.IO out perform the VisualBasic.FileIO?My program I am writing will be copying literally TB's worth of information onto server towers. I want to make sure I do not lose any time due to the library I am using.

View 2 Replies

C++ Unmanaged Code Versus Managed .net?

Sep 19, 2010

I am trying to develop a dll in VisualStudio2005 in vb.net that will communicate with a spectrometer attached to the USB port of the computer.Now the dll exists in C++ and it works like a charm. It is unmanaged code.Now if I try to translate this code in VB.net (because our app is in VB and my boss wants it in VB for maintainability) I have problems.

First of all, I am trying to create a file to open that port. The code in C++ looks like below and it works. Needles to say I tried to call the C++ dll from our app and it works. If I call the vb dll it doesn't. It gives me "access denied" no matter what I tried. I am not sure if my CreateFile is wrong or it's .net. I read somewhere that I need a manifest file included in the dll? Has anyone experience something like this? Why would i get "ACCESS DENIED" all the time?

// close and clear current stuff
ClosePort();
swprintf( sDevice, L"\\?\usb#vid_0765&pid_%s#******#{%s}", Device, PRIVATE_IID_STR );

[code].....

View 4 Replies

CHM File In VS 2008 Versus VS 2010?

Jul 16, 2009

I had a .chm file I used in VB2008 and I'm having trouble getting it to work for VB2010. I use the code below to reference the file.

vb
Module HTMPHelpAPI Public Const HH_DISPLAY_TOPIC As Short = &H0 Public Const HH_DISPLAY_TOC As Short = &H1 Public Const HH_DISPLAY_INDEX As Short = &H2 Public Const HH_DISPLAY_SEARCH As Short = &H3 Public Const HH_HELP_CONTEXT As Short = &HF Declare Function HTMLHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" (ByVal hwnd As IntPtr, ByVal lpHelpFile As String, ByVal uCommand As Int32, ByVal dwData As Int32) As Int32End Module

I then call it from my menu using this:

vb
Private Sub HelpToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HelpToolStripMenuItem1.Click HTMLHelp(IntPtr.Zero, "PE Files Help.chm", HH_DISPLAY_TOC, 0) 'Dim sHelpFile As String 'Dim sStartupPath As String 'sStartupPath = Application.StartupPath.ToString 'sHelpFile = Replace(sStartupPath, "in", "hlp") & "PE Files Help.chm" 'Me.hlpHtmlLocal.HelpNamespace = sHelpFile End Sub

I had found the commented out portion online and tried to get it to work, but nothing will bring up the file. Do I need to have it loaded into VB.Net somehow or point to it or does it need to be in a certain location?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved