Comments (3)
Hi dingoxiong,
Thanks for reporting this. Do you have an example piece of code that demonstrates the problem?
from sqlite-net-wp8.
1). Add a new method in SQLiteConnection:
public SQLiteCommand CreateCommand(string cmdText, Dictionary <string,string> paras){
if (!_open){
throw SQLiteException.New(SQLite3.Result.Error, "Cannot create commands from unopened database");
}
else{
var cmd = NewCommand();
cmd.CommandText = cmdText;
foreach (var o in paras){
cmd.Bind(o.Key, o.Value); //Binding Key and Value here!
}
return cmd;
}
}
2). Add a new method in SQLiteConnection:
public int Execute(string query, Dictionary <string, string> paras){
var cmd = CreateCommand(query, paras);
if (TimeExecution){
if (_sw == null){
_sw = new System.Diagnostics.Stopwatch();
}
_sw.Reset();
_sw.Start();
}
var r = cmd.ExecuteNonQuery();
if (TimeExecution) {
_sw.Stop();
_elapsedMilliseconds += _sw.ElapsedMilliseconds;
Debug.WriteLine(string.Format("Finished in {0} ms ({1:0.0} s total)", _sw.ElapsedMilliseconds, _elapsedMilliseconds / 1000.0));
}
return r;
}
3). then call this like:
string sqltext = "select count(*) from sometable where name = :name and state=:state";
Dictionary<string, string> paras = new Dictionary <string, string> ();
paras.Add("name","bear");
paras.Add("state", "1");
......
connection.Execute(sqltext, paras);
then:
SQLiteCommand.BindALL(Sqlite3Statement stmt) in this method,
b.Index = SQLite3.BindParameterIndex(stmt, b.Name);
this line always return 0;
from sqlite-net-wp8.
In your code above, what is stmt when you call SQLite3.BindParameterIndex? I don't see it declared.
from sqlite-net-wp8.
Related Issues (20)
- Imported projects SQLite.WP80.props not found HOT 8
- Foreign Keys & "ON DELETE CASCADE" HOT 3
- problem with sqlite HOT 9
- SQLite Upgrade to 3.8.1 HOT 2
- Doesn't work with VS13 HOT 8
- Upgrade reference of SQLite SDK when installing the package HOT 2
- Improve multiplatform support for visual studio HOT 3
- Update README for sqlite-net reference HOT 1
- database update issue HOT 2
- New Sqlite Version HOT 4
- Relationships HOT 1
- Have you experienced any memory related problems? HOT 1
- UpdateAll Exception HOT 3
- wp 8.1 HOT 2
- Support SQLite 3.8.6
- Expression is a namespace but used like a type HOT 1
- New version 3.8.8.3 HOT 1
- Sqlite3.set_temp_directory give me exception
- Can't Open In VS2015 HOT 1
- sqlite3 not registered
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlite-net-wp8.