Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
.Renewal_Start and .Renewal_Start have conflicting properties: DataType property mismatch.
 
im facing the error like this
 

 ReportDocument rptDoc = new ReportDocument();
    DataSet1 ds1 = new DataSet1(); // .xsd file name
    DataTable dt = new DataTable();
 
    // Just set the name of data table
    dt.TableName = "bill";
    dt = getAllOrders(); //This function is located below this function
    ds1.Tables[0].Merge(dt);<<<<<<getting error here : .column1 and .column1 have conflicting properties: DataType property mismatch.>>>>>>>
 
    // Your .rpt file path will be below
    rptDoc.Load(Server.MapPath("../WebSite2/CrystalReport.rpt"));
 
    //set dataset to the report viewer.
    rptDoc.SetDataSource(ds1);
    CrystalReportViewer1.ReportSource = rptDoc;
 

 
 public DataTable getAllOrders()
    {
        //Connection string replace 'databaseservername' with your db server name
        string sqlCon = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Apps\WebSite2\Database21.accdb;Persist Security Info=False;";
        OleDbConnection Con = new OleDbConnection(sqlCon);
        OleDbCommand cmd = new OleDbCommand();
        DataSet ds = null;
        OleDbDataAdapter adapter;
        try
        {
            Con.Open();
            cmd = Con.CreateCommand();
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "select *from bill";
            ds = new DataSet();
            adapter = new OleDbDataAdapter(cmd);
            adapter.Fill(ds, "bill");
            cmd.ExecuteNonQuery();
        }
}
Posted 16-Jul-12 1:34am
Edited 16-Jul-12 2:30am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

for ds1.Tables[0].Merge(dt); to work both the datatables have to be union compatible i.e. both of the should contain same number of columns and the respective columns should be of same datatype in each table.
 
Please ensure that both the datatables conform to this requirement and it will work fine.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Please check your DataTables that they exists same number of columns.
 
Thanks
Ashish
  Permalink  
Comments
Rahul Rajat Singh at 16-Jul-12 8:02am
   
+4 for the answer. would have given 5 if you would have mentioned that the datatype of respective columns should also match.
AshishChaudha at 16-Jul-12 8:03am
   
Thanks Rahul...Sorry for my mistake..
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

better to use join statement and make view before using it in dataset
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 459
1 Maciej Los 325
2 Sergey Alexandrovich Kryukov 234
3 DamithSL 233
4 BillWoodruff 200
0 OriginalGriff 7,168
1 Sergey Alexandrovich Kryukov 6,377
2 DamithSL 5,461
3 Manas Bhardwaj 4,876
4 Maciej Los 4,450


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 16 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100