我有一张表,其中一些行有一些空白cells.我尝试使用IS NULL函数选择这样的行.但查询选择0行.
select * from zzz_fkp_registration_female where fname is null;
(0 row(s) affected)
Run Code Online (Sandbox Code Playgroud)
现在我将查询更改为:
select * from zzz_fkp_registration_female where fname is null or fname ='';
Run Code Online (Sandbox Code Playgroud)
我得到了理想的结果.
为什么IS NULL没有给出结果?是什么区别IS NULL,并''由于细胞是空的.请解释.
CREATE TABLE [DBO].[TBL_PROFILE]
(
PROFILE_ID BIGINT IDENTITY(1, 1) NOT NULL
,NAME NVARCHAR(200) NOT NULL
,GENDER TINYINT NOT NULL
,CASTE NVARCHAR(15)
,QUALIFICATION NVARCHAR(50)
,COMPLEXION NVARCHAR(50)
,FEEDING_HBTS INT
,CONSTRAINT PK__PROFILE PRIMARY KEY (PROFILE_ID)
)
INSERT INTO [DBO].[TBL_PROFILE]
VALUES ('AJAY', 1, 'BRAHMAN', 'MASTER', 'FAIR', 1),
('JIRAM', 1, 'CHETTRI', 'BACHELOR', 'BLACK', 1),
('SUMAN', 1, 'NEWAR', '+2', 'BLACK', 1),
('HIRA', 1, 'MAGAR', 'BACHELOR', 'FAIR', 1),
('JANNY', 1, 'MAGAR', 'BACHELOR', 'MEDIUM', 1),
('RANVI', 1, 'NEWAR', 'BACHELOR', 'BLACK', 1),
('SURAJ', 1, 'BRAHMAN', 'BACHELOR', 'FAIR', 1);
Run Code Online (Sandbox Code Playgroud)
以上是SQL Server表和一些用于测试目的的示例数据. …
因为我们不能将null值赋给整数类型变量.所以我声明了int?类型变量并使用了三元运算符并试图将变量作为参数传递.但是得到错误.
int? SAP = 0;
SAP = SAP_num == null ? null :Convert.ToInt32(SAP_num); // SAP_num is string
Run Code Online (Sandbox Code Playgroud)
在尝试这样做时,我收到错误, type of conditional expression can not be determined because there is no implicit conversion betwen '<null>' and 'int'
然后我试了一下
int? SAP = 0;
SAP = Convert.ToInt32(SAP_num);
int confimation_cd = GetCode(SAP);
Run Code Online (Sandbox Code Playgroud)
在尝试执行此操作时获取错误,GetCode函数接受整数.cannot convert from 'int?' to 'int'
我的问题是,如果SAP_num IS NULL在函数GetCodeelse中传递为null,则传递为整数值.怎么做到这一点?
我使用友元函数重载了预增量运算符.在重载的friend函数中,变量的值显示正确.但是这个值没有显示在显示功能中,为什么呢?
#include <iostream>
using namespace std;
class Rectangle {
public:
int breadth;
public:
void read();
void display();
friend void operator ++(Rectangle r1);
};
void Rectangle::read()
{
cout << "Enter the breadth of the Rectangle: ";
cin >> breadth;
}
void operator++(Rectangle r1)
{
++r1.breadth;
cout<<r1.breadth<<endl; //correct result
}
void Rectangle::display()
{
cout<<breadth<<endl; // not showing pre-incremented value, why ???
}
int main()
{
cout<<"Unary Operator using Friend Function \n";
Rectangle r1;
r1.read();
++r1;
cout << "\n breadth of Rectangle after …Run Code Online (Sandbox Code Playgroud) 我为我的应用程序开发了几个页面。现在我需要添加这些页面的链接。到目前为止,我都是通过 url 浏览打开这些页面。
我的 web.php 页面
// for books
Route::get('/book','BookController@create');
Route::post('/book','BookController@store');
Route::get('/book/{id}','BookController@edit');
Route::patch('/book/{id}', 'BookController@update');
// for ordered books
Route::get('/order','OrderedBookController@create');
Route::post('/order','OrderedBookController@store');
Route::get('/billSearch','OrderedBookController@searchBill');
Route::post('/billSearch','OrderedBookController@billPay');
Route::post('/billSearch/{id}', 'OrderedBookController@pay');
// for Books Out
Route::get('/booksout','BooksOutController@create');
Route::post('/booksout','BooksOutController@store');
Run Code Online (Sandbox Code Playgroud)
路线对应的页面列表
book.blade.php
edit.blade.php
booksin.blade.php
booksout.blade.php
Run Code Online (Sandbox Code Playgroud)
浏览这些页面的本地主机 URL 是::
http://127.0.0.1:8000/book
http://127.0.0.1:8000/order
http://127.0.0.1:8000/billSearch // for Route::get('/billSearch','OrderedBookController@searchBill');
http://127.0.0.1:8000/booksout
Run Code Online (Sandbox Code Playgroud)
由于我是通过路线而不是页面浏览页面,如何在网络应用程序中创建链接?