【发布时间】:2013-05-30 01:59:16
【问题描述】:
在开始将 sqllite db 与 zumero 同步时遇到问题(使用 xamarin.ios)。我已经设置了我的同步命令:
cmd.CommandText =
@"SELECT zumero_sync(
'main',
@server_url,
@dbfile,
zumero_internal_auth_scheme('zumero_users_admin'),
@credentials_username,
@credentials_password,
@temp_path
);";
cmd.Parameters.AddWithValue ("@server_url", "https://zinst*****.s.zumero.net");
cmd.Parameters.AddWithValue ("@dbfile", dbPath);
cmd.Parameters.AddWithValue ("@credentials_username", "myusername");
cmd.Parameters.AddWithValue ("@credentials_password", "*mypassword*");
cmd.Parameters.AddWithValue ("@temp_path", System.IO.Path.GetTempPath());
但我遇到了一个异常:
Unhandled managed exception: Object reference not set to an instance of an object (System.NullReferenceException)
at System.Data.SQLite.SQLiteConnection.GetPointer () [0x00000] in <filename unknown>:0
at System.Data.SQLite.SQLiteConnection.ZumeroRegister () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.Data.SQLite.SQLiteConnection:ZumeroRegister ()
我已经用这个设置了 dbName:
string personalFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string dbName = "***.db";
string dbPath = Path.Combine ( personalFolder, dbName);
var conn = new SQLiteConnection ("Data Source=" + dbPath);
conn.Open ();
conn.ZumeroRegister();
希望有人能看到我做错了什么?谢谢。
【问题讨论】:
-
我们可以看到您实际打开/注册 SQLiteConnection 的代码吗?
-
确定:var conn = new SQLiteConnection ("Data Source=" + dbPath); conn.打开(); conn.ZumeroRegister();