.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

Not Equal To Operator (<>) Behavior

Posted By:      Posted Date: September 09, 2010    Points: 0   Category :Sql Server
 
Can someone explain this behavior with the <> operator when used along with a variable as opposed to a hard coded value. I'm totally confused (: Thanks for the help! -- Scenario 1: Value 3 is hard coded if object_id ('tempdb..#t') is not null drop table #t GO SET ANSI_NULLS OFF GO create table #t (c1 int null) insert into #t select 3 insert into #t select NULL SELECT * FROM #t WHERE c1 <> 3 -- 0 rows returned ---------------------------------------------------------------- ---------------------------------------------------------------- -- Scenario 2: Value 3 assigned to variable @a and used if object_id ('tempdb..#t') is not null drop table #t GO SET ANSI_NULLS OFF GO create table #t (c1 int null) insert into #t select 3 insert into #t select NULL declare @a int = 3 SELECT * FROM #t WHERE c1 <> @a -- 1 row returned with NULL value.. Why..?? ---------------------------------------------------------------- ---------------------------------------------------------------- -- NOTE: Both the queries ve the ANSI_NULLS OFF  


View Complete Post


More Related Resource Links

Using equal operator in transact-SQL for ntext datatype column

  
Hi, I've a problem with using equal operator in transact-SQL for ntext datatype column. (SQL Server 2000) I'm using the following SQL command text. use NorthwindSelect * from Categorieswhere Description ='Seaweed and fish' If I use 'like' operator intead of '=' then the qurey retuns correct value. Any idea about this? Any help is appreciated. Regards, Julia

Is this expected behavior, Less than equal to date.999 include next day

  

Environment: SQL Server 2005 Express 9.0.4053

 

Scenario: selection of records based on datetime field in range >=begindate and <=enddate

where begindate = "01/01/2010 00:00:00" and enddate = "10/10/2010 23:59:59.999"

 

Expectation: the result set would only include records with a datetime value less than or equal to "10/10/2010 23:59:59.999"

 

Results: the result set returned includes records with a datetime value of "10/11/2010 00:00:00.000" (the next day)

 

 

Is this expected behavior?


May we all make money in the sequel.

Custom Editing Behavior for DataGridView TextBox Columns

  
For various reasons I'm using a DataGridView instead of a ListView, and while configuring the DataGridView to look like a ListView wasn't much of a problem, there's one thing that got on my nerves, which is the behavior of textbox cells in edit mode: It is much too easy to leave the edit mode accidentally, simply by pressing the cursor keys at the wrong time. For example when the text caret is positioned behind the last character of the textbox cell content, and you press the right arrow key

Run Button Behavior: Suggestion/Bug

  

Note: This could be a bug or considered as suggestion. I am not looking for solution.


1: I have ImageWatermark.cshtml open and currently in focus.

2: I have Photo1.jpg selected in left Files workspace.

3: Now if I Click "Run", instead of opening ImageWatermark.cshtml it trys to open Photo1.jpg and it fails.

So ideally I would expect the "open file (ImageWatermark.cshtml) to run rather than running the selection from Workspace.


Word Automation - Multiple DCOM Errors/Behavior

  
Before I get started, I already know that Microsoft does not support and highly discourages server-based MS Office automation.  I've read a multitude of posts and smarmy "*wink*, here's a link" replies, so I'm looking for actual help here, not condescending reprimands.

That notwithstanding, here is my problem.  I have developed a simple method that will open a local Word document, modify some header information, and then save the document as a new file.  As expected, it works great as a console/windows app, but as soon as I went to ASP.NET, DCOM jacked my world up when accessing the app remotely from a different domain account (that has access to the ASP.NET app.  For reference, my method is shown below:

  

1    public static string ModifyAndSaveBuildDocument(string localFilePath, BuildDocumentType docType, string buildNumber, DateTime buildDate, string projectName)
2            {
3                try
4                {
5                    ProjectConfiguration config = (ProjectConfiguration)ConfigurationManager.GetSection("ProjectConfiguration");
6    

Advanced Basics: Revisiting Operator Overloading

  

On the conference circuit recently, I was speaking about some of my favorite new features in the Microsoft® . NET Framework 2. 0, using the content of three recent columns in this series as fodder. In my talk I sped through generics, operator overloading, and the BackgroundWorker component, all in the space of an hour (for the columns, see Advanced Basics: Being Generic Ain't So Bad, Advanced Basics: Calling All Operators, and Advanced Basics: Doing Async the Easy Way).

Ken Getz

MSDN Magazine September 2005


ModalPopup/UpdatePanel from codebehind, inconsistent behavior onClick

  

First post bear with me please:


I have a simple form with a list of linkbuttons, each fires the same onclick event which sets an indicator image.  I have a dummy button with style="display:none" which I have set as the TargetControlID of the modal.

onClick event from the imagebutton, the modal is shown via modal.Show().  The cancel button inside the modalpopup fires an event which turns off the indicator image and hides the modal via modal.Hide(). 

The events fire perfectly, it's very simple!  Although after doing some testing I noticed the modalpopup is not presented after the 6-10th cycle of clicking the open event, then clicking cancel.  The grey background appears but it is behind the main panel and the modal is either presented behind this or is just simply not displaying. 

I spent hours researching various methods, implemented the CancelControlID to see if it was somehow tied to my call of modal.Hide() that fails.

This occurs with an updatepanel only.  The behaviour is much cleaner this way, so I would hope to be able to implement this.  I have basically eliminated everything but these two events!  Please help


Syntax error (missing operator) in query expression

  
Good Day Gurus!

I have a Excel user application which has a user form (named 'Registo') that displays criteria and an image that has been entered in it's corresponding spreadsheet. This works the way it should.  There's also the ability to search the spreadsheet via a form (by clicking 'Pesquisar' button) this opens a search form. However, I having a bit of a problem with it. When I try to search for something it basically doesn't do anything at all. It just sits there. So I tried to debug it and I think I'm having a problem with either the JET db engine or somethign with teh query or maybe I don't have the correct reference.

I 'borrowed' this Excel application from another forum because it's exactly what I'm looking for! However, I suck at vb.

So I was hoping somebody could take a look at the code and see if I'm missing something?  I'm kinda' desparate to get this working because I'm been trying to figure it out for days and I'm running out of time.  Cry
 
Option Explicit

'constantes para auxiliar na verificação do código
Private Const Ascendente As Byte = 0

How to make "UserId" equal to the "logged-in user" in vb code behind

  


I need to insert a declaration in the codebehind function below that will make the variable "UserId" equal to the "logged-in user". In what way do I need to change the code below (elsewhere in the project, I successfully make reference to basically the same code and make the UserId equal to logged-in user by using this handler expression inside an image control: ImageUrl ='<%# Eval("UserId","Image.aspx?UserId={0}")%>'...But in the case below, the function is not fired by this expression, but rather by CustomValidator). Thanks very much.

 

Sub ValidateImage(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs)

        If Request.QueryString("UserId") IsNot Nothing Then
            ' Get the connection string from Web.config.

            Using conn As New SqlConnection(ConfigurationManager.ConnectionStrings("MyDatabaseConnectionString").ToString())
                ' Create a command object.
          

GridView Paging + Unsupported overload used for query operator 'Distinct'

  

The issue is two fold in my ASP.NET Web Application. I need to use a custom Distinct() via LINQ to SQL, and then assign thevar as a DataSource to a GridView. If I use the custom Distinct that implements IEqualityComparer, I get "Unsupported overload used for query operator 'Distinct'" exception. but if i somehow get past this, i get "The data source does not support server-side data paging" exception on GridView.DataBind(). here is the code:

var
distinct_employees =
    (from emp in wsq.LIT_Active_Employees
    where (String.IsNullOrEmpty(ssFirstName.Text) ? (emp.FIRST_NAME == null || emp.FIRST_NAME.StartsWith(String.Empty)) : emp.FIRST_NAME.Contains(ssFirstName.Text)) &&
            (String.IsNullOrEmpty(ssLastName.Text) ? (emp.LAST_NAME == null || emp.LAST_NAME.StartsWith(String.Empty)) : emp.LAST_NAME.Contains(ssLastName.Text)) &&a

Using the "IN" Operator with SelectCommand Parameter

  

Good morning everyone,

Any ideas how I can use an "IN" operator with a SelectCommand Parameter.


Example:

"SELECT * FROM tblEIT WHERE DEPT_ID IN (@DEPTS)"

Where @DEPTS is a value stored in a Cookie.  Cookie("DEPTS").Value is "232,243,250"


I keep getting an nvarchar to smallint conversion error.  Has anyone ever tried to do this?



Bizzare behavior of Digest authentication with HttpListener.

  

While trying to use Digest authentication with HttpListener, I expected it to act fairly close to how Basic does. Basic works fine with no surprises. With Digest, however: 

  1. HttpListener/http.sys driver takes on itself to authenticates user, without even passing request to my code (listener.GetContext() never gets unblocked) so ASP.NET application never has a chance to authenticate the user. I can see responses generated by "Microsoft-HTTPAPI/2.0" with WWW-Authenticate headers. I thought application should have a chance to authenticate the request with Digest user identity in the header. Is it possible to do?
  2. While insisting on Digest-authenticating users on its own, "Microsoft-HTTPAPI/2.0"/HttpListener/http.sys successfully authenticates domain users, but not computer users. I tried user name that includes computer name, realm name, computer name in the FQDN format - nothing works. Why such inconsistency?

Thank you,

Vlad.


Mod (%) operator on x86 vs x64

  
Hi all , I need help for resolve a strange bug – when I use mod (%) operator on x86 all good , But on x64 I get sometimes NaN as remainder ( it usually happens with Angle = 0). I managed to reproduce that bug outside my code , but only with Angle = double.Epsilon (at my code it also happens with Angle = 0). class Program { public const double M_PI = 3.14159265358979323846; static void Main(string[] args) { double m_2PI = (2 * M_PI); double m_Angle = double.Epsilon; double mod = (m_Angle % m_2PI); //x86 mod = 4.94065645841247E-324 //x64 mod = NaN if (double.IsNaN(mod)) Debug.Write(mod); } } Regards , Shay

Customer Segmentation based on purchase behavior

  
Hi I am trying to use MS clustering algorithm to segment our customers, just based on customer purchase behavior, we have two tables:   --customer table create table dm_msdm.scmolstp_city_mcc_accounts( olst_txn_acct_nbr character varying(19) NOT NULL ); --customer purchase table create table dm_msdm.scmolstp_city_mcc_aggregated( olst_txn_acct_nbr character varying(19) NOT NULL, olst_mcc_code numeric(4,0), olst_mcc_count integer, olst_mcc_total_amt numeric(11,2));   I learned that the MS_Sequence_clustering algorithm can deal with nest table , but in my case the sequence of stores(olst_mcc_code) is not important, how can I do this.   SQL Server 2008 GUI does not allow us to choose the MS_sequence_clustering algorithm, but only the clustering algorithm, does it mean if we use nest tables then MS_sequence_clustering algorithm is automatically chosen?

Customer Segmentation based on purchase behavior

  
Hi I am trying to use MS clustering algorithm to segment our customers, just based on customer purchase behavior, we have two tables:   --customer table create table dm_msdm.scmolstp_city_mcc_accounts( olst_txn_acct_nbr character varying(19) NOT NULL ); --customer purchase table create table dm_msdm.scmolstp_city_mcc_aggregated( olst_txn_acct_nbr character varying(19) NOT NULL, olst_mcc_code numeric(4,0), olst_mcc_count integer, olst_mcc_total_amt numeric(11,2));   I learned that the MS_Sequence_clustering algorithm can deal with nest table , but in my case the sequence of stores(olst_mcc_code) is not important, how can I do this.   SQL Server 2008 GUI does not allow us to choose the MS_sequence_clustering algorithm, but only the clustering algorithm, does it mean if we use nest tables then MS_sequence_clustering algorithm is automatically chosen?
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend