 |
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
 | This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

October 4th, 2009, 01:51 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2009
Posts: 165
Thanks: 5
Thanked 6 Times in 6 Posts
|
|
can not be used as metod.......
Hello Sir, Well long time no see (in fact no postings).
Well I'm working on webshop application and I met to a problem. It generates an error on running project
Error states like this
Code:
Non-invocable member 'System.Configuration.ConfigurationManager.ConnectionStrings' cannot be used like a method.
Error is found in App_code/AppConfiguration.cs file.
Following is the code that I'm using....
Code:
if (ConfigurationManager.ConnectionStrings("WebShop") != null) {
tempValue = ConfigurationManager.ConnectionStrings("WebShop").ConnectionString;
}
|
|

October 4th, 2009, 04:19 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2009
Posts: 165
Thanks: 5
Thanked 6 Times in 6 Posts
|
|
errors in webshop.....
Hello Sir, I have more errors in webshop application. While running application there is error in App_Code/Helper.cs file which is as follows
Code:
The name 'My' does not exist in the current context
And the code used in file is
Code:
if (myGridView.Rows.Count > 0) {
myGridView.FooterRow.Cells[0].Text = "Totals:";
myGridView.FooterRow.Cells[3].Text = string.Format("{0:c}", theShoppingCart.Total);
string theSubject = "Your order at Wrox WebShop";
string theMessage = My.Computer.FileSystem.ReadAllText(AppConfiguration.ConfirmationMessageLocation);
System.Net.Mail.SmtpClient mySmtpClient = new System.Net.Mail.SmtpClient();
theMessage = theMessage.Replace("##ShoppingCart##", GetHtmlFromControl(myGridView));
theMessage = theMessage.Replace("##OrderNumber##", orderId.ToString());
mySmtpClient.Send("[email protected]", emailAddress, theSubject, theMessage);
}
I've tried to find for My in the whole project but could not find.
Can you please tell where such declaration is?????
|
|

October 5th, 2009, 03:56 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
My is VB specific: http://msdn.microsoft.com/en-us/vbasic/ms789188.aspx
You'll need to rewrite this code using the IO.File class...
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

October 5th, 2009, 12:14 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2009
Posts: 165
Thanks: 5
Thanked 6 Times in 6 Posts
|
|
My namespace problem
Hello sir,
As you did mention about the MY namespace and provided the link to the msdn library, I searched about that.
There I found Microsoft.VisualBasic.Devices namespace as an alternative to MY namespace.
I created the instance of Computer class named computer and used in my project as follows.....
Code:
try {
Computer computer = new Computer();
GridView myGridView = CreateGridView();
myGridView.DataSource = theShoppingCart.Items;
try goes here........
string theSubject = "Your order at Wrox WebShop";
string theMessage = computer.FileSystem.ReadAllText(AppConfiguration.ConfirmationMessageLocation);
}
It is not notifying error any more about MY namespace. I have not used IO.File class But I want to know that what was that all to do????
suggestion on msdn library is as follows..
How to: Use the My Namespace (C# Programming Guide)
The Microsoft.VisualBasic.MyServices namespace (My in Visual Basic) provides easy and intuitive access to a number of .NET Framework classes, enabling you to write code that interacts with the computer, application, settings, resources, and so on. Although originally designed for use with Visual Basic, the MyServices namespace can be used in C# applications.
For more information about using the MyServices namespace from Visual Basic, see Development with My.
Adding a Reference
Before you can use the MyServices classes in your solution, you must add a reference to the Visual Basic library.
To add a reference to the Visual Basic library
1.
In Solution Explorer, right-click the References node, and select Add Reference.
2.
When the References dialog box appears, scroll down the list, and select Microsoft.VisualBasic.dll.
You might also want to include the following line in the using section at the start of your program.
C#
using Microsoft.VisualBasic.Devices;
Example
This example calls various static methods contained in the MyServices namespace. For this code to compile, a reference to Microsoft.VisualBasic.DLL must be added to the project.
C#
Code:
using System;
using Microsoft.VisualBasic.Devices;
class TestMyServices
{
static void Main()
{
// Play a sound with the Audio class:
Audio myAudio = new Audio();
Console.WriteLine("Playing sound...");
myAudio.Play(@"c:\WINDOWS\Media\chimes.wav");
// Display time information with the Clock class:
Clock myClock = new Clock();
Console.Write("Current day of the week: ");
Console.WriteLine(myClock.LocalTime.DayOfWeek);
Console.Write("Current date and time: ");
Console.WriteLine(myClock.LocalTime);
// Display machine information with the Computer class:
Computer myComputer = new Computer();
Console.WriteLine("Computer name: " + myComputer.Name);
if (myComputer.Network.IsAvailable)
{
Console.WriteLine("Computer is connected to network.");
}
else
{
Console.WriteLine("Computer is not connected to network.");
}
}
}
|
|

October 5th, 2009, 12:36 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
If it works, it works.
Part of My is reproducible in C#, but not all of it as some functionality depends on the VB compiler.
Imar
|
|

October 9th, 2009, 01:50 AM
|
|
Authorized User
|
|
Join Date: Sep 2009
Posts: 24
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
how to get appconfiguration in c#
i am getting error the name appconfiguration in current context,
how can i access it.
|
|

October 9th, 2009, 03:24 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Heuh? Don't understand what you're asking....
Imar
|
|

October 9th, 2009, 05:53 AM
|
|
Authorized User
|
|
Join Date: Sep 2009
Posts: 24
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Error:
I am using below code and i ah added key in web.config too,
Code:
try {
Computer computer = new Computer();
GridView myGridView = CreateGridView();
myGridView.DataSource = theShoppingCart.Items;
try goes here........
string theSubject = "Your order at Wrox WebShop";
string theMessage = computer.FileSystem.ReadAllText(AppConfiguration.ConfirmationMessageLocation);
}
when i apply this code it give error that appconfiguration does not exist in current context.
and when i am getting key confimationmessagelocation as
computer.FileSystem.ReadAllText(ConfigurationManag er.AppSettings.Keys[11])
11 is index of confirmation messagelocation key in web.config
it is searching in my computer c drive,
but i want it from my server root statictext folder
|
|

October 9th, 2009, 09:17 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2009
Posts: 165
Thanks: 5
Thanked 6 Times in 6 Posts
|
|
reply to appconfiguration file
Hello ashwaniraj,
You probably might be missing reference to the AppConfiguration.cs file or not created it yet. This file exist in the App_Code folder. Check for references first. (in App_code/DataAccess/ShopManagerDB.cs , App_Code/Helper.cs )
The code you posted here was related to MY namespace in my scenario.
|
|
The Following User Says Thank You to jack_hilary For This Useful Post:
|
|
|

October 10th, 2009, 01:15 AM
|
|
Authorized User
|
|
Join Date: Sep 2009
Posts: 24
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
For mail on other stages
thanx jack it is working now
now i want to add mail on every stage like payment received ,verified ,dispatch,
how can i use this grid
any suggestion
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Best metod of using book |
merlin89 |
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 |
3 |
August 14th, 2006 04:43 PM |
|
 |