Two questions regarding

Results 1 to 2 of 2

Thread: Two questions regarding

  1. #1
    Join Date
    Dec 1969

    Default Two questions regarding

    1.I am using OledbDataAdapter to fill a dataset. The code segment is as follows:<BR>//////////////////////////////////////////////////////////////<BR> OleDbConnection con1 = new OleDbConnection(ConfigurationSettings.AppSettings["accessString"]);<BR> string strSQL = "SELECT * FROM EventDate WHERE EventDay =&#039;" + selDate +"&#039; AND Name=&#039;" + (string)Session["User"] +"&#039;";<BR> OleDbCommand cmd = new OleDbCommand(strSQL, con1);<BR> OleDbDataAdapter da = new OleDbDataAdapter();<BR> da.SelectCommand = cmd;<BR> DataSet myDataSet = new DataSet();<BR> da.Fill(myDataSet,"EventDate");<BR>/////////////////////////////////////////////////////////////<BR><BR>The Fill method always gives argument mismatch error. If I remove the WHERE clause form strSQL (i.e. string strSQL = "SELECT * FROM EventDate) , then no error shows at all. So my question is that what goes wrong with the query having WHERE clause?<BR><BR>2. In AO.Net, how to I determine if a specific record exists in DB or not?<BR><BR>I appreciate any suggestion.<BR>Cindy

  2. #2
    Join Date
    Dec 1969

    Default RE: Two questions regarding

    I guess EventDay is a date type field, u need to convert &#039;selDate&#039; variable into date type, u can u convert method in sql for the same.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts