Error while i run my crystal report

Posted by Padeep1888 under C# on 7/16/2011 | Points: 10 | Views : 5070 | Status : [Member] | Replies : 6
Sorry for my poor english .I am new to c# sharp. I am using a mdf file as my database created using database file in c#. So i choose dataset to create my report.i have added the table bill_detail by drag and drop into dataset. i have designed my crystal report and it functions as follows. i have a textbox and a button along with crystallreport viewer.

How it should function : I have to enter the customer number in the textbox and click on the button. once clicked the following code is executed

SqlDataAdapter sda = new SqlDataAdapter();
DataSet ds = new DataSet();
string query, query2;
query = "select * from bill_detail where custmer_number = " + textBox1.Text;
cn1.Open();


sda.SelectCommand = new SqlCommand(query, cn1);
sda.Fill(ds);

CrystalReport2 cry = new CrystalReport2();
cry.SetDataSource(ds);
crystalReportViewer1.ReportSource = cry;

But when i click it shows me VSHost32.exe has stopped working




Responses

Posted by: Vuyiswamb on: 7/17/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Do the Following

1) Right to on your project and go to Properties -> Debug ->(Check the)Enable unmanaged code debugging
2)Clean and rebuild your project and run it again.



Thank you for posting at Dotnetfunda
[Administrator]

Padeep1888, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Padeep1888 on: 7/17/2011 [Member] Starter | Points: 25

Up
0
Down
Thanks Vuyiswamb for your reply

i tried as u said but after that this the the error i getting now when i try to run the crystal report

error "Unhandled exception at 0x090cf46b in WindowsFormsApplication10.exe: 0xC0000005: Access violation reading location 0x00000004 ."

Is there something wrong with my code ? or any other problem

Padeep1888, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 7/17/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
now we are getting somewhere. no there is nothing wrong with you code, this is a permission error. try to make sure there are no permission issues in crystal and try again. i am going out i will be back in 30 min. tell me how it goes.


Thank you for posting at Dotnetfunda
[Administrator]

Padeep1888, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Padeep1888 on: 7/17/2011 [Member] Starter | Points: 25

Up
0
Down
i am sorry i am not very good at this !
i didnt set any permission constraints in the program using them as it is !
which permission do i have to alter


Padeep1888, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 7/17/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
try to restart you machine and try it again , if it doesnt help look at this
http://support.microsoft.com/kb/324879

Thank you for posting at Dotnetfunda
[Administrator]

Padeep1888, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Padeep1888 on: 7/17/2011 [Member] Starter | Points: 25

Up
0
Down
I tried retarting the system It didnt work.

its told to update to win server 2003 !
i ma not sure which win server i am using
i am using DOTNET 2010 and i created a database file in c# using tool-> connect to database -> selected database file (.mdf)



Padeep1888, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response