I execute a query twice to mySql DB with different parameters.
i found that if my first parameter is empty, then the second query parameter will be empty too, even i pass a non-empty string into second query.
for example:
my test code:
Code: Select all
TestContext.TestDataContext con = new TestContext.TestDataContext();
con.Log = Console.Out;
var a = con.Testtables.FirstOrDefault(x => x.Name == "");
var b = con.Testtables.FirstOrDefault(x => x.Name == "abc");
Code: Select all
SELECT t1.Id, t1.Name
FROM test.testtable t1
WHERE t1.Name = :p0 LIMIT 1
-- p0: Input VarChar (Size = 0; DbType = AnsiString) []
-- Context: Devart.Data.MySql.Linq.Provider.MySqlDataProvider Model: an Build: 3.0.5.0
SELECT t1.Id, t1.Name
FROM test.testtable t1
WHERE t1.Name = :p0 LIMIT 1
-- p0: Input VarChar (Size = 0; DbType = AnsiString) []
-- Context: Devart.Data.MySql.Linq.Provider.MySqlDataProvider Model: an Build: 3.0.5.0
but if i pass a non-empty string into first query, then both queries work well.
Code: Select all
TestContext.TestDataContext con = new TestContext.TestDataContext();
con.Log = Console.Out;
var a = con.Testtables.FirstOrDefault(x => x.Name == "cde");
var b = con.Testtables.FirstOrDefault(x => x.Name == "abc");
Code: Select all
SELECT t1.Id, t1.Name
FROM test.testtable t1
WHERE t1.Name = :p0 LIMIT 1
-- p0: Input VarChar (Size = 3; DbType = AnsiString) [cde]
-- Context: Devart.Data.MySql.Linq.Provider.MySqlDataProvider Model: an Build: 3.0.5.0
SELECT t1.Id, t1.Name
FROM test.testtable t1
WHERE t1.Name = :p0 LIMIT 1
-- p0: Input VarChar (Size = 3; DbType = AnsiString) [abc]
-- Context: Devart.Data.MySql.Linq.Provider.MySqlDataProvider Model: an Build: 3.0.5.0