Skip to content

Commit f80da9c

Browse files
committed
Add Examples to README
1 parent fa187a4 commit f80da9c

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,54 @@ Documentation is [here](https://directsql.github.io/DirectSQL.Document/doc/).
2323

2424
Please try :smile:.
2525

26+
# Examples
27+
## Example1
28+
```
29+
public static void example()
30+
{
31+
SqlLiteDatabase db = new SqlLiteDatabase("connectionString_to_yourdb");
32+
db.Process((connection, transaction) =>
33+
{
34+
SqlLiteDatabase.Query(
35+
"select TEST_VAL1,TEST_VAL2 from TEST_TABLE where TEST_VAL1 = @val1",
36+
new (String, object)[] {ValueTuple.Create("@val1","abcdef")},
37+
connection,
38+
transaction,
39+
(result) => {
40+
while (result.Next())
41+
{
42+
var resultValues = result.ResultValues;
43+
Console.Out.WriteLine("TEST_VAL1:" + resultValues.TEST_VAL1);
44+
Console.Out.WriteLine("TEST_VAL2:" + resultValues.TEST_VAL2);
45+
}
46+
}
47+
);
48+
});
49+
}
50+
```
51+
52+
## Example2
53+
```
54+
public static void example2()
55+
{
56+
SqlLiteDatabase db = new SqlLiteDatabase("connectionString_to_yourdb");
57+
db.Process((connection, transaction) =>
58+
{
59+
dynamic[] resultArray =
60+
SqlLiteDatabase
61+
.LoadSqlResult(
62+
"select TEST_COL1,TEST_COL2 from TEST_TABLE",
63+
connection,
64+
transaction);
65+
66+
Console.Out.WriteLine("TEST_VAL1:" + resultArray[0].TEST_VAL1);
67+
Console.Out.WriteLine("TEST_VAL2:" + resultArray[0].TEST_VAL2);
68+
69+
});
70+
}
71+
```
72+
73+
2674
# How to Build
2775
````
2876
git clone git@github.com:DirectSQL/DirectSQL.git

0 commit comments

Comments
 (0)