Skip to content
Loading
  • Amit Mohanty
    +1
    Hey change your OleDbCommand to below code.
    1. OleDbCommand cmd = new OleDbCommand("SELECT [PropertyId], [Period], [CalendarText], [StayId] " +  
    2.                                         "FROM EVBookings " +  
    3.                                         "WHERE [Period] = #@PeriodCol# " +  
    4.                                         "ORDER BY [Period]", conn); 
    +1
  • Mageshwaran R
    +1
    Hi,
    try this code:
    1. OleDbCommand cmd = new OleDbCommand("SELECT [PropertyId], [Period], [CalendarText], [StayId] " +    
    2.                                         "FROM EVBookings " +    
    3.                                         "WHERE [Period] = @PeriodCol " +    
    4.                                         "ORDER BY [Period]", conn);    
    5.     cmd.Parameters.AddWithValue("@PeriodCol", Period);    
    6.    
    7.     cmnd.Executenonquery();  
    8.     oledbdataadapter da=new oledbdataadapter(cmnd);  
    9.     datatable dt=new datatable();  
    10.     da.fill(dt);  
    11.     datagrid.itemsource=da.Asdataview();  
     
    +1
  • 0
    Thx for yr quick response. Unfortunately I still get an error:
     
    System.Data.SqlDbType' does not contain a definition for 'integer'
     
    My using are:
     
    using System;
    using System.Diagnostics;
    using System.Configuration;
    using System.Data;
    using System.Data.SqlClient;
    using System.Data.SqlTypes;
    using System.Data.OleDb;
    using System.Drawing;
    using System.Globalization;
    using System.Windows.Forms;
     
    There's no System.Data.SqlDbType available. Is there some reference I need?
    Did try to change the type to Decimal with no size specified, but that gives the original error again.
    0
  • 0
    @Amit Mohanty,
    thx for yr reply, but this gives a syntax error. 
    0
  • 0
    Additional info.
    Tried closing and disposing previously used readers (rdr). No go. Same error.
    Tried using different names for the readers (rd1, rd2, etc). No go. Same error.
    The more stumped I get the more I get the idea that the problem is just to obvious to see it 
    0
  • 0
    Ok, there it is.
    Was looking at a version of the database which hadn't the column GuestName in the Stays table.
     
    Thx for taking the time looking into this and responding.
     
    I'll get my coat  
     
    Cheers!
    Tsjallie 
    0