SQLce 2 questions

  • Thread starter Thread starter franky
  • Start date Start date
F

franky

1- Does somebody know a Tool like Profiler for the SQL Server 2000. I woud
like to trace my query.

2- I have some bizard problem with simple query.
string query1 = "Select * from employee where employyeID = 147"
string query2 = "Select * from employee where Name= 'vicky'"
string query3 = "Select * from employee where employyeID = ?"
string query4 = "Select * from employee where Name= '?'"

Query 1, 2, 3 work fine.... but Query 4 return no record?!?!

______________________________________________________
this is all my code:
SqlCeConnection cn = new SqlCeConnection(ConnStr);

cn.Open();

SqlCeCommand oCmd = new SqlCeCommand(query4,cn);

SqlCeParameter p = new SqlCeParameter("@name", SqlDbType.NVarChar,10);

oCmd.Parameters.Add(p);

oCmd.Parameters["@name"].Value = txtparam1.Text;

oCmd.Prepare();

SqlCeDataAdapter oAdpater = new SqlCeDataAdapter(oCmd);


DataSet dtsTemp = new DataSet();

oAdpater.Fill(dtsTemp);


Datagrid1.DataSource = dtsTemp.Tables[0];


cn.Close();





Thanks

__________________________

Franky

(e-mail address removed)
 
Hi franky,

There is no profiler for sqlce that I am aware of. In regards to your last
query, putting quotes around it makes it a string value. Unless you have a
'?' in your name column, it will return zero rows.


--------------------
| From: "franky" <[email protected]>
| Subject: SQLce 2 questions
| Date: Fri, 2 Apr 2004 08:23:32 -0500
| Lines: 53
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: hse-quebeccity-ppp3497573.sympatico.ca 65.92.227.252
| Path:
cpmsftngxa06.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:50168
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| 1- Does somebody know a Tool like Profiler for the SQL Server 2000. I
woud
| like to trace my query.
|
| 2- I have some bizard problem with simple query.
| string query1 = "Select * from employee where employyeID = 147"
| string query2 = "Select * from employee where Name= 'vicky'"
| string query3 = "Select * from employee where employyeID = ?"
| string query4 = "Select * from employee where Name= '?'"
|
| Query 1, 2, 3 work fine.... but Query 4 return no record?!?!
|
| ______________________________________________________
| this is all my code:
| SqlCeConnection cn = new SqlCeConnection(ConnStr);
|
| cn.Open();
|
| SqlCeCommand oCmd = new SqlCeCommand(query4,cn);
|
| SqlCeParameter p = new SqlCeParameter("@name", SqlDbType.NVarChar,10);
|
| oCmd.Parameters.Add(p);
|
| oCmd.Parameters["@name"].Value = txtparam1.Text;
|
| oCmd.Prepare();
|
| SqlCeDataAdapter oAdpater = new SqlCeDataAdapter(oCmd);
|
|
| DataSet dtsTemp = new DataSet();
|
| oAdpater.Fill(dtsTemp);
|
|
| Datagrid1.DataSource = dtsTemp.Tables[0];
|
|
| cn.Close();
|
|
|
|
|
| Thanks
|
| __________________________
|
| Franky
|
| (e-mail address removed)
|
|
|
 
Back
Top