null

Stored procedure to handle null parameter

空扰寡人 提交于 2019-12-24 03:01:27
问题 I'm sure this has a very simple answer I am not finding... I have a simple hierarchy in a database where each row has a ParentId. If ParentId IS NULL , then it's a root element. I have the stored procedure: CREATE PROCEDURE GetByParent @parentId int AS BEGIN SELECT * FROM TABLE1 WHERE ParentId = @parentId END It works fine if I send an integer, but if I send NULL it becomes ParentId = NULL , which doesn't work in ANSI. I know there is COALESCE(@parentId, ParentId) , but that returns all rows

Stored procedure to handle null parameter

…衆ロ難τιáo~ 提交于 2019-12-24 03:01:09
问题 I'm sure this has a very simple answer I am not finding... I have a simple hierarchy in a database where each row has a ParentId. If ParentId IS NULL , then it's a root element. I have the stored procedure: CREATE PROCEDURE GetByParent @parentId int AS BEGIN SELECT * FROM TABLE1 WHERE ParentId = @parentId END It works fine if I send an integer, but if I send NULL it becomes ParentId = NULL , which doesn't work in ANSI. I know there is COALESCE(@parentId, ParentId) , but that returns all rows

Sum, Avg, Max, Min, Count of NULL values

孤者浪人 提交于 2019-12-24 02:18:41
问题 In MySQL SELECT 2+NULL FROM tbl_name will return NULL , since MySQL cannot interpret NULL as a number. But why will SELECT SUM(quantity) FROM tbl_name not return NULL if just one of the values is NULL ? The same goes for MIN , MAX , AVG , etc. Since MySQL doesn't know what NULL could be, shouldn't it return NULL for all the specified functions? 回答1: This is a good question, and one that does not have a good answer. The treatment of NULL in your two examples is different. The fundamental

Set null to property in mvvm WPF when nothing is filled in textbox

倾然丶 夕夏残阳落幕 提交于 2019-12-24 01:44:53
问题 I implemented a textbox, and this binds to a viewmodel. I fill in the textbox default by '100' for example, but if i change this to 10, the property always sets correctly. But when i delete all the numbers, i want that the property is set to null. But it just don't set the value when nothing is filled in. He just keeps the last value.. this is my code , viewmodel + xaml: public double MaxTime { get { return maxTime; } set { maxTime = value; OnPropertyChanged("MaxTime"); if

Losing reference to static data in Android Studio

試著忘記壹切 提交于 2019-12-24 00:42:51
问题 I'm having issues with instances of static data being lost when my app goes into the background, causing null pointer exception errors. The static data is very context or 'state' dependant, and can't be generated generically on initialisation. To ensure I keep hold of this data, will I be force to write the data to storage or this there some other way of ensuring my static data isn't lost when the app is put into the background? 回答1: Static fields are part of the class, not an object. When

c# combobox binding and first null value

放肆的年华 提交于 2019-12-24 00:33:53
问题 I got probably a small problem but can't find workaround... I have a combobox on a winform, and this combobox has binding to a column in a datatable. This column (keeps printer name) is null value allowed. I want the combobox to display a first value string "default" and then the printers list. But I don't want "default" string to be stored in datatable, just null. cmbDefaultPrinter.DataSource = this.availablePrinters; cmbDefaultPrinter.DisplayMember = "Display"; cmbDefaultPrinter.ValueMember

How to find the name of not-null constraints in SQL Server

a 夏天 提交于 2019-12-24 00:28:26
问题 How can I find the name of a named not-null constraint in SQL Server? I can find check constraints, default constraints, FK constraints, PK constraints and unique constraints, but the NN constraint has eluded me. 回答1: You can't. Whilst the syntax does accept a name... CREATE TABLE T ( C INT CONSTRAINT NN NOT NULL ) ... and it is parsed and validated as a name ... CREATE TABLE T ( C INT CONSTRAINT

Null values in PHP SoapClient calls

霸气de小男生 提交于 2019-12-23 22:19:33
问题 I'm writing a PHP client to a C#/WCF web service. The parameters for some of the calls consist of instances of business classes that I instantiate in PHP and pass via HTTP POSTs in SOAP formatted payloads to the webservice. The constructors for some of these classes have one or more optional parameters, of which some are of type Int32. When I set these parameters as optional in PHP and then send the instances up to the webservice they are being transmitted as empty strings (well, more

JTDS Android connect to SQL Server - Error Connection null

回眸只為那壹抹淺笑 提交于 2019-12-23 21:03:14
问题 hi im trying to connect to my MS SQL Server 2008 R2 from my Android application this is the code: try { Log.i("Login", "Establishing Connection..."); // SET CONNECTIONSTRING Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance(); Log.i("JDBC","found"); Connection DbConn = DriverManager.getConnection("jdbc:jtds:sqlserver://MYPC/" + DB + ";instance=SQLEXPRESS;user=" + USERNAME + ";password=" + PASSWORD); Log.i("Login","Connected"); Statement stmt = DbConn.createStatement(); ResultSet

null as instance of a type parameter

寵の児 提交于 2019-12-23 20:36:53
问题 Ok, I know better than to use nulls as a design choice, but in this case I have to. Why the following does not compile? def test[T<:AnyRef](o :Option[T]) :T = o getOrElse null Error:(19, 53) type mismatch; found : Null(null) required: T Note: implicit method foreignKeyType is not applicable here because it comes after the application point and it lacks an explicit result type def test[T<:AnyRef](o :Option[T]) :T = o getOrElse null ^ 回答1: Null is a subtype of all reference types, but the fact