function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JoelJoel 

Using AspSample with Visual Studio .NET Academic 2003

I've installed Visual Studio .NET Academic 2003, and I'm wondering how to convert the AspSample web that I downloaded from sforce.com into a "Solution Project" that I can work on in Visual Studio .NET Academic. I've tried creating a new "Solution Project" in VS.NET Academic, and then creating new files and then copying over the code from the corresponding files from AspSample, but I keep getting errors. So I'm wondering if there is a way to convert the entire AspSample web into a "Solution Project"? Or is there another sample that I can download from sforce.com that would download a "Solution Project" that would have the same types of files as in AspSample (especially the "Contacts.aspx" file). Any guidance that you can provide would be appreciated. Thanks. Joel
J_HinderJ_Hinder
Not sure what in the aspsample stuff, but if you need to get the basics for using .Net with salesforce, download the .Net Getting Started package. From there, browse to a directory where a project file can be found (either foosample.vbproj or foosample.csproj). Double click it open it up in Visual Studio and click on the build button. When Visual Studio prompts you to create a solution file, just say yes....
JoelJoel
I've tried downloading the .Net Getting Started Package, and it doesn't seem to give me the example aspx pages that I'm looking for. What I'm looking for is a page exactly like "Contacts.aspx" that was in the AspSampleSetup.zip file that I downloaded from sforce.com. But AspSampleSetup opened as a web folder, and I need a solution project that I can open and modify with Visual Studio .NET 2003.

I tried I tried building it myself as a new solution from the files in the AspSample, but it has turned into a reference nightmare. For example, it has a reference to a "sforceP" that I can't figure how to add as a Web Reference.

Thanks.

Joel
SuperfellSuperfell
download the partner WSDL from the app, feed that to the Add Web Reference wizard, call it sforceP
JoelJoel
Simon:

...thanks. As you suggested, I downloaded the partner WSDL from the app, and added it as a Web Reference as "sforceP". Unfortunately, after I did a build it went for just one error message to about a dozen error messages. The error messages are: 1) for the Contacts.aspx.cs file it says ...name 'Contact' does not exist in ...'SalesForce.sforce' [note: SalesForce is the name of the Solution]; 2) also for Contacts.aspx.cs file it says ... name 'obj' could not be found [this error showed up on 6 lines]; 3) for the EnterpriseLoginBean.cs file it says ...name 'DataProtector' could not be found [this showed up on 6 lines]; 4) also for the EnterpriseLoginBean.cs file it says ...name 'dp' could not be found [this showed up on 2 lines]; and 5) also for the EnterpriseLoginBean.cs file it says The variable 'e' is declared but never used.

What would you suggest that I try at this point?

Thanks!
Joel
JoelJoel
Hi Simon:

As a follow-up to my message of several hours ago, I was able to create and copy in the "DataProtector.cs" file to the project, and when I did a build, it eliminated the errors related to "EnterpriseLoginBean.cs" file (except for the warning about variable 'e' being declared but never used).

However, all of the error messages related to Contacts.aspx.cs are still there (ie, the ones I listed in my previous message).

So if you have some thoughts on what to do about these errors that would be great.

Thanks!

Joel
DevAngelDevAngel
Joel,

Are you using .NET 2003 or 2005? You can use the 2005 express for integration with salesforce.com and it has a few features that make make data binding very easy.
JoelJoel
Dave:

I'm now using .NET 2003. I had tried using 2005 Express, but it ended up causing alot of problems. So I ended up uninstalling it, and installing .NET 2003 instead.

At this point, I am hoping that I can get the AspSample .aspx pages to run in .NET 2003.

What do you think?

Thanks!
Joel
SuperfellSuperfell
This is one for DevAngel i think, i wasn't able to open the installed project file because its a web project, and i don't have the FP extensions on my IIS box (nor could you pay me enough to install them!).

Why don't you start a new project of the type you want, and cut'n'paste the code you're interested in.
JoelJoel
Hi Simon:

Thanks. Yes, that's exactly what I've ended up doing . . . I created a new project and then I cut n' pasted the code from the pages from the AspSample download that it looked like I needed.

I may be getting close to getting it to work, but it appears that there is a problem related to the query that is done of the "Contact" database table from the contacts.aspx.cs page that I copied from the AspSample download:

Here's the query:

sforce.QueryResult qr = Utility.GetBinding(this.Context).query("Select Id, FirstName, LastName, AccountId, Phone From Contact");

And here's where the error messages point to (where it says 'Contact' does not exist and 'obj' could not be found, repsectively):

sforce.Contact obj = (sforce.Contact)qr.records[i];
string name = obj.LastName;

What do you think?

Thanks!
Joel
JoelJoel
Dave:

I've built a project in Visual Studio .NET 2003 from the "AspSample" files that I downloaded from sforce.com (using .NET 2005 caused problems on my server). Fyi, I downloaded the wsdl.jsp file from the "Partner" link in the "App Setup" section of sforce.com, and then did an "Add Web Reference" for "sforce" and then again for "sforceP".

My problem is that when I go to build the project, in the "Contacts.aspx.cs" file I get error messages that point to the following lines of code (the error messages say 'Contact' does not exist and 'obj' could not be found, repsectively):

sforce.Contact obj = (sforce.Contact)qr.records[i];
string name = obj.LastName;

If it makes a difference, in this "Contacts.aspx.cs" file , before the above code, there is the following query:

sforce.QueryResult qr = Utility.GetBinding(this.Context).query("Select Id, FirstName, LastName, AccountId, Phone From Contact");


What would you suggest that I do to get rid of these error messages?

Thanks!
Joel
DevAngelDevAngel
Joel,

Here is a different very simple sample. Hope this helps.

Right click and do a save as on the attachment, then rename it to .zip on you hard drive.

After unzipping into your web directory, modify the web.config to use the user name and password for your org.




JoelJoel
Dave:

..thanks much. This worked GREAT!

I was able to get the "SimpleSample" that you attached to work, and then I took what I learned from it and was then able to get the "AspSample" to work.

Great suggestion, and thanks again!

Regards,
Joel
JoelJoel
Dave:

The SimpleSample you sent me worked just fine. But today the pages like "webform1.aspx" just stopped working (error on the references.cs page line 375: object[] results = this.Invoke("query", new object[] { ).

I also noticed that my username and password with my developer account at sforce.com stopped working as well.

So I created a new developer account with AppExchange. Then I changed the username and password on the "web.config" page of the SimpleSample that you had sent me, to match this new account. But the webform1.aspx page still didn't work.

Has the WSDL or something changed due to the change from "sforce" to "AppExchange"?

Is there some other reason why the SimpleSample you sent me before now doesn't work?

Thanks!

Joel
SuperfellSuperfell
see the API Down? thread.