我在 SQL Server 2008 R2 中有一个过程,我想将数据输入到 vol_Hours 列并在它之前检查它如果它不为空然后加上它在列中的旧数据的条目,如果它是空然后将条目添加到没有加上 NULL 值的列。我不能添加 2+NULL,因为它是 = NULL。我的代码是:
create procedure updateVolunteerHours
@vol_ID int, @vol_Hours int
As
if vol_Hours is NULL
-- vol_Hours it is the Column Name
Update Personal_Information set vol_Hours = @vol_Hours where vol_ID = @vol_ID
else
Update Personal_Information set vol_Hours = @vol_Hours + vol_Hours where vol_ID = @vol_ID
Run Code Online (Sandbox Code Playgroud) 我正在构建一个带有sqflite数据库的应用程序,当我运行我的应用程序时,我收到此错误:
I/flutter ( 9532): eeeeeeeee 绑定尚未初始化。I/flutter (9532):ServicesBinding 绑定 mixin 上的“实例”getter 仅在绑定初始化后才可用。I/flutter (9532):通常,这是通过调用“WidgetsFlutterBinding.ensureInitialized()”或“runApp()”(后者调用前者)来完成的。通常,此调用是在“void main()”方法中完成的。“ensureInitialized”方法是幂等的;多次调用它并没有什么害处。调用该方法后,“实例”getter 将返回绑定。I/flutter ( 9532):在测试中,可以调用“TestWidgetsFlutterBinding.ensureInitialized()”作为测试的“main()”方法中的第一行来初始化绑定。I/flutter ( 9532):如果 ServicesBinding 是自定义绑定 mixin,则还必须有一个自定义绑定类,例如 WidgetsFlutterBinding,但它混合在所选绑定中,并且这是在使用“实例”之前必须构造的类吸气剂。nnnnnnnnnnnn
这是我的main()
void main() async {
WidgetsFlutterBinding.ensureInitialized;
await DBHelper().initDb();
runApp(const MyApp());
}
Run Code Online (Sandbox Code Playgroud)
这是initDB()
initDb() async {
try {
String databasePath = await getDatabasesPath(); //The break point stops here and show me the error above.
String path = join(databasePath, 'task.db');
Database ourdb = await openDatabase(path,
onCreate: _onCreate, version: _version, onUpgrade: _onUpgrade);
return ourdb;
} catch (e) …Run Code Online (Sandbox Code Playgroud)