|
|
|
Read the documentation on the functions next time. It's in documented that these functions operate on Radians, not Degrees. The conversion between the two is easy though.
|
|
|
|
|
Hi Can you help on those queries which is provided on the blog. www.dotnet-discussion.blogspot.com
Thanks
Sudha
|
|
|
|
|
Hi Can you help on those queries which is provided on the blog. www.dotnet-discussion.blogspot.com
Thanks
Sudha
|
|
|
|
|
No.
If you have a question, then post it here on Code Project. Don't try to drive traffic to other sites.
|
|
|
|
|
No. I'm not going to help someone on another site and who hyjaks someone elses thread.
|
|
|
|
|
I need to know how to map fields coming from a stored procedure to output fields on a crystal report. Any feedback is greatly appreciated. The output that I'm getting on the report is the name of the fields instead of the values coming from the database.
Also, If at least someonce can tell me how to assign the database value on the .xsd Default Value, that'd help. Right now if I type "TEST" on the .xsd Default Value property (hardcoded), it gets displayed on the report. I need to be able to set that value with the one coming from my database.
The code is based on this sample:
http:
Here's my code:
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web.Configuration;
namespace project
{
public partial class check : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ReportDocument rptCheck = new ReportDocument();
dsCheck ds = new dsCheck(); // .xsd file name
DataTable dt = new DataTable();
// Just set the name of data table
dt.TableName = "Crystal Report Checks";
dt = getChecks(); //This function is located below this function
ds.Tables[0].Merge(dt);
// Your .rpt file path will be below
rptCheck.Load(Server.MapPath("checkprt.rpt"));
//set dataset to the report viewer.
CrystalReportViewer1.ReportSource = rptCheck;
}
public DataTable getChecks()
{
string sqlCon = WebConfigurationManager.ConnectionStrings["hello"].ConnectionString;
SqlConnection Con = new SqlConnection(sqlCon);
SqlCommand cmd = new SqlCommand();
DataSet ds = null;
SqlDataAdapter adapter;
try
{
Con.Open();
//Stored procedure calling. It is already in sample db.
cmd.CommandText = "spGetData";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Date", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output;
cmd.Parameters.Add("@Name", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output;
cmd.Parameters.Add("@Amount", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output;
cmd.Parameters.Add("@AccountID", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output;
cmd.Connection = Con;
ds = new DataSet();
adapter = new SqlDataAdapter(cmd);
adapter.Fill(ds);
//get output param list
string Count1 = cmd.Parameters["@Date"].Value.ToString();
string Count2 = cmd.Parameters["@Name"].Value.ToString();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
cmd.Dispose();
if (Con.State != ConnectionState.Closed)
Con.Close();
}
return ds.Tables[0];
}
}
}
|
|
|
|
|
Have you looked at the tutorials, this is SSRS 101 and is a well documented [^]area.
Also look into embedded (local)[^] reports these are suffixed with RDLC
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
No I haven't. I'm my wondering if my issue is related to mapping the xsd fields to the database. Do I have to do that? or the data that is coming from my stored procedure is good enough? If so, the question here is...how do I get that data to the output fields on the crystal report?
|
|
|
|
|
I have a question about how to obtain the results, condition codes and messages from a C# 2008 console application.
Basically I have received the C# 2008 console application code that calls a remote webservice and consumes the results. The console application runs by giving it commands to know what method in the web service to call.
Now I am going to write a C# 2010 service application that will call the C# 2008 console and run the commands in a specificed order. There are three types of calls that need to be called in a specified order.
This new application will call the console application by executing the commands in a spcific order. However, I would like to know how this new application can obtain the results of the console application.
How will the console application pass it's results back to my new application?
Would it be better if I put the code I am describing in the application I am referring to? If so, can you tell me why and how to accomplsih that task?
|
|
|
|
|
I believe you must be using the Process class to run you console application, in which case you can use the Process.StandardOutput[^] to get a StreamReader object to read the output from you console app.
|
|
|
|
|
I think it would be better to reorganize your code. The console project you wrote really should be a library/API, if you're going to consume it from another application (ie, the windows service).
I'd suggest converting your console application into a class library project. Then, both the windows service and console can create their own implementations. So, let's say you execute the console app like this:
myconsoleapp.exe "servicename"
Then, create a library project with a public method "RunService":
public class MyAPI
{
public string ExecuteService(string serviceName)
{
}
}
Now both the console app, and your new windows service can consume MyAPI as needed.
|
|
|
|
|
dbaseman wrote: Now both the console app, and your new windows service can consume MyAPI as needed
Of course it would require quite a bit more work than that. After all it probably takes input, and that would need to be dealt with. And it definitely creates output, which the OP mentioned, and that too would need to be dealt with.
|
|
|
|
|
Right, of course, but my point is that it's far better to interact with an API, than trying to parse the output from a console application.
|
|
|
|
|
dbaseman wrote: but my point is that it's far better
No not really.
Sometime it can be much better not to do it that way. For example, if one has a server and one needs to interact with unmanaged C++ code in C# where the C++ code is known to be flaky (or even might be.) Because one doesn't want the server to exit every time the C++ code throws a system exception.
Or because one doesn't have the original code. Or doesn't have a license to modify it. Or because one has a number of applications, all supporting the same idiom (console) and a single solution versus numerous others is more cost effective.
|
|
|
|
|
I never really liked console apps, here is what I would do.
Create a windows forms app that will allow you to input information, a button and a display control.
The input will be specific to our needs and set the defaults to the test information.
The button will call the method you use in the console app
The output (I usually use a listbox ot a textbox) will take the output you are currently using.
I find this the easiest way to debug an console app that has been snaffled from the interweb. Make sure you keep all your processing (the console methods) in a seperate class as it is then easy to create a library class from that (as jschell suggested).
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have a question about how to obtain the results, condition codes and messages from a C# 2008 console application.
Basically I have received the C# 2008 console application code that calls a remote webservice and consumes the results. The console application runs by giving it commands to know what method in the web service to call.
Now I am going to write a C# 2010 service application that will call the C# 2008 console and run the commands in a specificed order. There are three types of calls that need to be called in a specified order.
This new application will call the console application by executing the commands in a spcific order. However, I would like to know how this new application can obtain the results of the console application.
How will the console application pass it's results back to my new application?
Would it be better if I put the code I am describing in the application I am referring to? If so, can you tell me why and how to accomplsih that task?
|
|
|
|
|
Hi,
You can't directly call the console application methods. you can create command line argument to execute methods inside your application in order. But to get the result from the application you may need some class defined in your application. Instead i suggest you to create one Class library and shift your all logic in your class library. Then use this library in your service as well as in your Console application.
Hope this works for you
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
Do you have access to the source of the console application? If so, include it in your new application and modify it accordingly so that it has methods you can call which return something or give you events.
If not: does it have an API specified that isn't just the command line? There may be public methods available which do what you want.
Finally, if you just have a console app and no other way into it, you can redirect its stdin, stderr and stdout and read its output from there. This is quite a fragile approach so it isn't something you should do unless you have to.
In this case you say that the console application is talking to a web service. Can't you just talk to the web service directly?
|
|
|
|
|
In a C# 2008 console application, the log file must be redirected to a dos popup window since that is what I see in the dos popup window. I do not see any kind of log files being saved. Thus can you tell me how to change code that goes to the dos popup menu and have the results saved to a log file instead?
|
|
|
|
|
I'm not sure I understand your problem, but if you just want to save results to a log file rather than printing to the command window, then open the file, write to it and close it. Here's what I do to save computed results in a console app.
StreamWriter outFile1 = new StreamWriter(FILENAME1);
outFile1.WriteLine(Heading);
outFile1.WriteLine(Title + DateTime.Now.ToString());
...
...
outFile1.WriteLine("Termination due to " + TerminationReason);
outFile1.WriteLine();
outFile1.Close();
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Actually you have two problem as i can see,
1) you would like to store log information somewhere.
Ans: To write log in log file you need to implement some logging in your application. i suggest you to use Log4Net. You can found lots of example for log4net configurations here.[^].
2) You want to show your 2nd console window when error occur.
Ans : See this[^] discussion to open new console window and you can print your log in it.
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
Am I to understasbd that this is an existing third-party app over which you have no control?
|
|
|
|
|
Since I am new to working with C# 2008 desktop application, I have the following questions to ask since I need place files in a directory path that looks like D://app1/test/mm-dd-yyyy/customer number/type of document being worked on:
1. How would you code the month-date-year format (mm-dd-yyyy) part of the path?
2. The path of the path that stays the same is D://app1/test/. The dynamic part of the path is mm-dd-yyyy/customer number/type of document being worked on.
Thus can you tell me how to code the static part of the path and setup the dynamic part of the path so that I can place files in the dymanic part of the path?
3. Once I have the new path location, can you tell me how to place files in the new directory path location?
|
|
|
|