Showing posts with label public. Show all posts
Showing posts with label public. Show all posts

Thursday, March 29, 2012

newbie: Instance failure!

Hey

asp.net 2.0

When I run the code below I get the runtime error "Instance Failure"

public static ICollection getInbox()
{
ArrayList al = new ArrayList();
ConnectionStringSettings css =
ConfigurationManager.ConnectionStrings["aspnet_DB"];
SqlDataSource sds = new SqlDataSource(css.ConnectionString, "SELECT
UserName from aspnet_Users");
try
{
IEnumerable INames = sds.Select(DataSourceSelectArguments.Empty);
foreach (DataRowView row in INames)
{
al.Add(row["UserName"]);
}
}
catch (SqlException sqlException)
{
Debug.WriteLine(sqlException.Message.ToString());
}
sds.Dispose();
return al;
}

The error occur at this line:
"IEnumerable INames = sds.Select(DataSourceSelectArguments.Empty);"

Just in case, here is a copy of my web.config file:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
</appSettings>
<connectionStrings>
<add name="aspnet_DB" connectionString="Data
Source=.\\SQLEXPRESS;Integrated
Security=True;AttachDBFilename=|DataDirectory|aspn etdb.mdf;User
Instance=true" />
</connectionStrings>
<system.web>
<roleManager enabled="true"/>
<authentication mode="Forms"/>
<compilation debug="true"/>
<profile enabled="true">
<properties>
<add name="Picture" type="System.Byte[]" />
<add name="PictureType" type="string" />
</properties>
</profile>
</system.web>
</configuration>

My gut feeling tells me it might be caused by the db connectionsting, but
I'm not sure... I'm trying to connect to the express database within the
project!

Any suggestions to what I should do to fix this?

Jeff"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:ueLDl0PnGHA.1444@.TK2MSFTNGP02.phx.gbl...
> Hey
>
> asp.net 2.0
>
> When I run the code below I get the runtime error "Instance Failure"
>
> public static ICollection getInbox()
> {
> ArrayList al = new ArrayList();
> ConnectionStringSettings css =
> ConfigurationManager.ConnectionStrings["aspnet_DB"];
> SqlDataSource sds = new SqlDataSource(css.ConnectionString, "SELECT
> UserName from aspnet_Users");
> try
> {
> IEnumerable INames = sds.Select(DataSourceSelectArguments.Empty);
> foreach (DataRowView row in INames)
> {
> al.Add(row["UserName"]);
> }
> }
> catch (SqlException sqlException)
> {
> Debug.WriteLine(sqlException.Message.ToString());
> }
> sds.Dispose();
> return al;
> }
>
> The error occur at this line:
> "IEnumerable INames = sds.Select(DataSourceSelectArguments.Empty);"
>
> Just in case, here is a copy of my web.config file:
> <?xml version="1.0"?>
> <configuration
> xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
> <appSettings>
> </appSettings>
> <connectionStrings>
> <add name="aspnet_DB" connectionString="Data
> Source=.\\SQLEXPRESS;Integrated
> Security=True;AttachDBFilename=|DataDirectory|aspn etdb.mdf;User
> Instance=true" />
> </connectionStrings>
> <system.web>
> <roleManager enabled="true"/>
> <authentication mode="Forms"/>
> <compilation debug="true"/>
> <profile enabled="true">
> <properties>
> <add name="Picture" type="System.Byte[]" />
> <add name="PictureType" type="string" />
> </properties>
> </profile>
> </system.web>
> </configuration>
>
> My gut feeling tells me it might be caused by the db connectionsting, but
> I'm not sure... I'm trying to connect to the express database within the
> project!
>
> Any suggestions to what I should do to fix this?
>
> Jeff
>

Thursday, March 22, 2012

Newby Question Linking of data between HTML and ASP!

Xref: TK2MSFTNGP08.phx.gbl microsoft.public.dotnet.framework.aspnet:297891
Hi:
I am an utter virgin at ASP, but have experience in HTML!
I have a very basic question.
I have an ASP sheet, where I wish to permit the user to enter a code, and th
en return the
results of a query against a table, using that code. My problem is that I do
n't quite know
how to:
A Present the end user input to the query
B. Present the results to the HTML: code.
In the query I have tried common sql techniques such as "Like{Input the code
]", but that
does not work.
I know there must be an easy way, but it too simple to show up in the materi
als I am
reading.
Can someone point me in the direction of an answer.
Thanks
John Baker> Can someone point me in the direction of an answer.
You can find an answer on the ASP ewsgroups:
microsoft.public.inetserver.asp.db
microsoft.public.inetserver.asp.general
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.
"John Baker" <Baker.JH@.Verizon.net> wrote in message
news:cccf01dcm7rb7khonngaqa95qv2o8n15sh@.
4ax.com...
> Hi:
> I am an utter virgin at ASP, but have experience in HTML!
> I have a very basic question.
> I have an ASP sheet, where I wish to permit the user to enter a code, and
> then return the
> results of a query against a table, using that code. My problem is that I
> don't quite know
> how to:
> A Present the end user input to the query
> B. Present the results to the HTML: code.
> In the query I have tried common sql techniques such as "Like{Input the
> code]", but that
> does not work.
> I know there must be an easy way, but it too simple to show up in the
> materials I am
> reading.
> Can someone point me in the direction of an answer.
> Thanks
> John Baker
Kevin:
Unfortunately Verizon does not offer them.
Any other alternatives?
John
"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote:

>microsoft.public.inetserver.asp.general
This is a newsgroup. If you have Outlook Express, you have a news reader.
Using Outlook Experss's newsreader, go to the msnews.microsoft.com news
server and you'll find all of the Microsoft newsgroups.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.
"John Baker" <Baker.JH@.Verizon.net> wrote in message
news:r2rf015ek9aq5rc9kj82ra9vgll0t6fe4u@.
4ax.com...
> Kevin:
> Unfortunately Verizon does not offer them.
> Any other alternatives?
> John
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote:
>
>

Newby question: Do overloaded members need to be declared as 'Public'?

I am referring to using VB.NET in ASP.NET.
TIAonly if you need public access. for sub-class use protected is preferred.
-- bruce (sqlwork.com)
"Blue Streak" <rdlebreton@.hotmail.com> wrote in message
news:1134594348.385454.274400@.g44g2000cwa.googlegroups.com...
>I am referring to using VB.NET in ASP.NET.
> TIA
>