Showing posts with label lots. Show all posts
Showing posts with label lots. Show all posts

Friday, March 30, 2012

How do I move a project between machines?

Hi,

I'm an SQL Server novice.

After developing some websites (VS 2005 VWD), my machine started to crumble. (e.g, SQL Server won't uninstall and lots of other software problems)

So I bought a new machine and set up a clean installation of SQL Server 2005 Standard and Visual Studio 2005 standard.

I copied my old "projects" folder to the new machine but I cannot use it.

1: When I try to import I get a "cannot import external files" error.

2: When I click on a project, it launches VS 2005 and I can edit etc.
However, when I try to run the website in VS 2005, I get the following error.

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) an error

Please can someone let me know how I can get my "old" projects running in my new environment?

Thanks

Ken

Has your sql server name or instance changed if so you will have to change your dataset to represent the new server.|||

Hi Ray,

Thanks for the reply.
Yes - I'm using a completely new setup. New server name and new instance name.


But I'm still struggling to get to grips with the management console. I bought several books on SQL Server 2005 and spent lots of time ploughing through the zillions of help files but I have not yet found a "How to" that meets my level of need to understand what I'm doing with SQL Serverr Management Studio.

So, when you say "change the dataset" I don't know what steps to take to do that. If you have a minute, I would very much appreciate some basic guide that shows me how to "change the dataset to represent the new server".

Its hard being a novice!

Ken

|||In your visual studios project you should have set up your project to connect to the database this is a dataset. It is a setup for a connection to the database from visual studios. You should look in your project, and should be somewhere in your solution depending on which type you are creating.|||

Hi Ray,

Thanks for your comment.

One of the problems I'm experienceing is that most of the well intended advice is couched in metaphorical terms rather than in "Press this then click that" terms.

Let's use the sample SQL Express personal website starter kit as an example.

Which DB?: In the App_Data folder thare are two .mdf files: ASPNETDB.MDF and Personal.mdf I know that the application needs both of these DB's. If I change the connection string, do I have to do it for both of these DB's ?

Connection String?: I have been floundering about in the help files without finding anything that I have found to be helpful. Where do I find the "connection string" to these DB's? what does a connection string look like? , How do I change it? What effect does it have on the rest of the project? Do I have to do anything else to make the app run under SQL Server Standard?

If I can get answers to these questions it will help me to get moving forward.

Thanks for your help.

Ken

How do I move a project between machines?

Hi,

I'm an SQL Server novice.

After developing some websites (VS 2005 VWD), my machine started to crumble. (e.g, SQL Server won't uninstall and lots of other software problems)

So I bought a new machine and set up a clean installation of SQL Server 2005 Standard and Visual Studio 2005 standard.

I copied my old "projects" folder to the new machine but I cannot use it.

1: When I try to import I get a "cannot import external files" error.

2: When I click on a project, it launches VS 2005 and I can edit etc.
However, when I try to run the website in VS 2005, I get the following error.

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) an error

Please can someone let me know how I can get my "old" projects running in my new environment?

Thanks

Ken

Has your sql server name or instance changed if so you will have to change your dataset to represent the new server.|||

Hi Ray,

Thanks for the reply.
Yes - I'm using a completely new setup. New server name and new instance name.


But I'm still struggling to get to grips with the management console. I bought several books on SQL Server 2005 and spent lots of time ploughing through the zillions of help files but I have not yet found a "How to" that meets my level of need to understand what I'm doing with SQL Serverr Management Studio.

So, when you say "change the dataset" I don't know what steps to take to do that. If you have a minute, I would very much appreciate some basic guide that shows me how to "change the dataset to represent the new server".

Its hard being a novice!

Ken

|||In your visual studios project you should have set up your project to connect to the database this is a dataset. It is a setup for a connection to the database from visual studios. You should look in your project, and should be somewhere in your solution depending on which type you are creating.|||

Hi Ray,

Thanks for your comment.

One of the problems I'm experienceing is that most of the well intended advice is couched in metaphorical terms rather than in "Press this then click that" terms.

Let's use the sample SQL Express personal website starter kit as an example.

Which DB?: In the App_Data folder thare are two .mdf files: ASPNETDB.MDF and Personal.mdf I know that the application needs both of these DB's. If I change the connection string, do I have to do it for both of these DB's ?

Connection String?: I have been floundering about in the help files without finding anything that I have found to be helpful. Where do I find the "connection string" to these DB's? what does a connection string look like? , How do I change it? What effect does it have on the rest of the project? Do I have to do anything else to make the app run under SQL Server Standard?

If I can get answers to these questions it will help me to get moving forward.

Thanks for your help.

Ken

Monday, March 12, 2012

How do I format mailing address fields for display in reports

I am very new to development with SQL Server but I have lots of
experience with Access. I am producing a report in VB.Net using
CrystalReports that will display a company's address differently
depending on the contents of the data. For example, if the second
address line is NULL then I don't want it to display at all or if the
customer is not from the US then I want the country field displayed. My
database design is your typical address line 1, line 2, city, state,
postal code, country with lookup tables providing the full text for
state/provinces and countries. There's nothing fancy with the data.
My learning curve is both with Crystal and with SQL Server. I think
I'm better off trying to write a function in Transact SQL that I
could call from the query that VB.Net will use to create the XML that
will drive the report. I simply want to send a completely formatted
string to VB.Net, including commas, spaces and carriage returns and
line feeds. Please let me know if I'm nuts. I'm basing this
decision on the fact that Crystal is not the easiest tool to deal with
and that I probably have a better chance doing it on the server end.
I also have to believe that I'm not the first one who's ever wanted
to do this and am hoping that this code is out there somewhere for me
to legally pilfer and modify. I'm posting because my searches have so
far been unsuccessful.
Now, if anyone in Redmond is listening, those VB developers need to
walk down the hall and talk to the Access developers! I REALLY miss the
Access report writer and query builder. Their functionality and
productivity are superb. I find myself often linking Access to my SQL
Server databases, going into Access to build my query and then cutting
and pasting the SQL into Enterprise Manager. Now, if I could just write
my user-defined functions in VB or C then the world would then be a
much prettier and productive place.I kind of understand where you are coming from here, but you are probably
best served by doing this kind of formatting within crystal rather than in
T-SQL. This really is a presentation issue rather than a data issue.
"Foofs" <marta@.mindcrafted.com> wrote in message
news:1132331118.184758.42090@.g43g2000cwa.googlegroups.com...
>I am very new to development with SQL Server but I have lots of
> experience with Access. I am producing a report in VB.Net using
> CrystalReports that will display a company's address differently
> depending on the contents of the data. For example, if the second
> address line is NULL then I don't want it to display at all or if the
> customer is not from the US then I want the country field displayed. My
> database design is your typical address line 1, line 2, city, state,
> postal code, country with lookup tables providing the full text for
> state/provinces and countries. There's nothing fancy with the data.
> My learning curve is both with Crystal and with SQL Server. I think
> I'm better off trying to write a function in Transact SQL that I
> could call from the query that VB.Net will use to create the XML that
> will drive the report. I simply want to send a completely formatted
> string to VB.Net, including commas, spaces and carriage returns and
> line feeds. Please let me know if I'm nuts. I'm basing this
> decision on the fact that Crystal is not the easiest tool to deal with
> and that I probably have a better chance doing it on the server end.
> I also have to believe that I'm not the first one who's ever wanted
> to do this and am hoping that this code is out there somewhere for me
> to legally pilfer and modify. I'm posting because my searches have so
> far been unsuccessful.
> Now, if anyone in Redmond is listening, those VB developers need to
> walk down the hall and talk to the Access developers! I REALLY miss the
> Access report writer and query builder. Their functionality and
> productivity are superb. I find myself often linking Access to my SQL
> Server databases, going into Access to build my query and then cutting
> and pasting the SQL into Enterprise Manager. Now, if I could just write
> my user-defined functions in VB or C then the world would then be a
> much prettier and productive place.
>|||There is a *crystal* related microsoft newsgroup.
"Foofs" <marta@.mindcrafted.com> wrote in message
news:1132331118.184758.42090@.g43g2000cwa.googlegroups.com...
>I am very new to development with SQL Server but I have lots of
> experience with Access. I am producing a report in VB.Net using
> CrystalReports that will display a company's address differently
> depending on the contents of the data. For example, if the second
> address line is NULL then I don't want it to display at all or if the
> customer is not from the US then I want the country field displayed. My
> database design is your typical address line 1, line 2, city, state,
> postal code, country with lookup tables providing the full text for
> state/provinces and countries. There's nothing fancy with the data.
> My learning curve is both with Crystal and with SQL Server. I think
> I'm better off trying to write a function in Transact SQL that I
> could call from the query that VB.Net will use to create the XML that
> will drive the report. I simply want to send a completely formatted
> string to VB.Net, including commas, spaces and carriage returns and
> line feeds. Please let me know if I'm nuts. I'm basing this
> decision on the fact that Crystal is not the easiest tool to deal with
> and that I probably have a better chance doing it on the server end.
> I also have to believe that I'm not the first one who's ever wanted
> to do this and am hoping that this code is out there somewhere for me
> to legally pilfer and modify. I'm posting because my searches have so
> far been unsuccessful.
> Now, if anyone in Redmond is listening, those VB developers need to
> walk down the hall and talk to the Access developers! I REALLY miss the
> Access report writer and query builder. Their functionality and
> productivity are superb. I find myself often linking Access to my SQL
> Server databases, going into Access to build my query and then cutting
> and pasting the SQL into Enterprise Manager. Now, if I could just write
> my user-defined functions in VB or C then the world would then be a
> much prettier and productive place.
>

Wednesday, March 7, 2012

How do I export a report using c#?...

Hi there.
Can anyone tell me how to export a report to PDF using only c#? I have seen lots of examples of how to do it using asp.net but I am only interested in using c#.
Thanks in advance to anyone who can help me out!Hi
Try this code

CrystalReport1 cr = new CrystalReport1();
ExportOptions exportOpts = new ExportOptions();

DiskFileDestinationOptions diskOpts = ExportOptions.CreateDiskFileDestinationOptions();

// Set the export format.
exportOpts.ExportFormatType = ExportFormatType.WordForWindows;
exportOpts.ExportDestinationType =ExportDestinationType.DiskFile;

// Set the disk file options.
diskOpts.DiskFileName = "C:\\Documents and Settings\\ceeb\\Desktop\\111.doc";
exportOpts.ExportDestinationOptions = diskOpts;
cr.Export(exportOpts);

All the best
:thumb:|||Thanks for the help.

In the end i did it like this:

public void exportReport(String reportName, String exportName)
{
try
{
//Create a ReportDocument and load in the location of the report
ReportDocument report = new ReportDocument();

report.Load(reportName);

//Create a DiskFileDestinationOptions object so you can set where the
//pdf is written to
DiskFileDestinationOptions diskFileDestinationOptions = new DiskFileDestinationOptions();

//append a filename to the export path and set this file as the filename property for
//the DestinationOptions class
diskFileDestinationOptions.DiskFileName = exportName;

//set the required report ExportOptions properties
ExportOptions exportOptions = report.ExportOptions;
exportOptions.DestinationOptions = diskFileDestinationOptions;
exportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
exportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;

//Once the export options have been set for the report, the report can be exported. The Export command
//does not take any arguments

// Export the report
report.Export();
Console.WriteLine(reportName + " exported successfully as " + exportName);
}
catch (Exception e)
{
Console.WriteLine(e.Message.ToString());
}

}|||I am trying to do the same thing, the only issue is , I either want to pass a data set (only a few records , not the whole table) or pass a parameter to the crystal report (like employee id) so I can filter what the report/pdf file end up displaying.

I posted the code in asp.net - scroll to crystal reports threads.

any suggestions??

bev