Showing posts with label property. Show all posts
Showing posts with label property. Show all posts

Saturday, March 31, 2012

the authentication process of personalization-profile configuration

hi, recently, i came to study asp.net 2.0, and met a problem like this.

the proflie property can let user briefly and conveniently to create personalization properties in actual use, which change the traditional

approach.but because of the personalization, profile property should set authorization and authentication configuration first. and when the

visitor do not login, asp.net has supplied a solution to resovle the situation, after simply setting the configuration <anonymousIdentification

enabled ="true"> , asp.net can record the personalization information for the anonymous visitor automatically. but what, i wonder to konw,

asp.net had done for us? how it can get the indentification of the visitor and make distinction between visitors,and what had

happened to make it possible?

Anonymous user is the one who is not logged in (so it wont bother for asp.net either its you or me, both are anonymous). When a user is not logged in and if the anonymousIdentification is set to true, the AnonymousUserTemplates will be shown as well as AnonymousProfile information. Profile will track individually only of those whose membership was created.

Thanks


thank you for your reply! best wish to you from the east!


Good Luck!

Thanks

-- mark the thread as resolved, if this post answers you!

Wednesday, March 28, 2012

The best way to validate UserControls

Hi,
I have a user control that has a property named "Text"
Is there any way that I use a RequiredFieldValidator or CompareValidator to
validate my user control's value?
I tried it and I received this error:
Control 'cboCountry' referenced by the ControlToValidate property of
'valCountry' cannot be validated.
Thank you,
MaxOn Jul 13, 10:05 pm, "Max2006" <alanal...@dotnet.itags.org.newsgroup.nospam> wrote:
> Hi,
> I have a user control that has a property named "Text"
> Is there any way that I use a RequiredFieldValidator or CompareValidator t
o
> validate my user control's value?
> I tried it and I received this error:
> Control 'cboCountry' referenced by the ControlToValidate property of
> 'valCountry' cannot be validated.
> Thank you,
> Max
Hi...
i assume you have a control inside the usercontrol that receive input
from user and you do want to validate the input ...
here are the options you have...
1. add the requited field validator for the input in the usercontrol
rather that in the page...
2. validate the text using server side validation... (for this you
need to write a server side validation method...)
Thanks
Md. Masudur Rahman (Munna)
kaz Software Ltd.
www.kaz.com.bd
http://munnacs.110mb.com
Hi Max,
Yes, I agree with Masudur's opinion. Also, if you do want to make Validator
controls directly function against your ascx usercontrol, you can use the
"ValidationPropertyAttribute" class to define a property to be validatable
in your ascx control's code behind.
#ValidationPropertyAttribute Class
http://msdn2.microsoft.com/en-us/li...tionpropertyatt
ribute(VS.80).aspx
Based on my test, through the intellisense not work, you can manually put
usercontrol's ID to validateor's "ControlToValidate" property and so far it
seems only server-side validation is working in this case.
Anyway, I think Masudur's suggested approaches are still the preferred ones
here.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Hi Max,
Have you got any further idea on this or does the information helps you
some? Please feel free to post here if there is anything else we can help.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

The best way to validate UserControls

Hi,

I have a user control that has a property named "Text"

Is there any way that I use a RequiredFieldValidator or CompareValidator to
validate my user control's value?

I tried it and I received this error:

Control 'cboCountry' referenced by the ControlToValidate property of
'valCountry' cannot be validated.

Thank you,
MaxOn Jul 13, 10:05 pm, "Max2006" <alanal...@dotnet.itags.org.newsgroup.nospamwrote:

Quote:

Originally Posted by

Hi,
>
I have a user control that has a property named "Text"
>
Is there any way that I use a RequiredFieldValidator or CompareValidator to
validate my user control's value?
>
I tried it and I received this error:
>
Control 'cboCountry' referenced by the ControlToValidate property of
'valCountry' cannot be validated.
>
Thank you,
Max


Hi...

i assume you have a control inside the usercontrol that receive input
from user and you do want to validate the input ...
here are the options you have...
1. add the requited field validator for the input in the usercontrol
rather that in the page...
2. validate the text using server side validation... (for this you
need to write a server side validation method...)

Thanks
Md. Masudur Rahman (Munna)
kaz Software Ltd.
www.kaz.com.bd
http://munnacs.110mb.com
Hi Max,

Yes, I agree with Masudur's opinion. Also, if you do want to make Validator
controls directly function against your ascx usercontrol, you can use the
"ValidationPropertyAttribute" class to define a property to be validatable
in your ascx control's code behind.

#ValidationPropertyAttribute Class
http://msdn2.microsoft.com/en-us/li...tionpropertyatt
ribute(VS.80).aspx

Based on my test, through the intellisense not work, you can manually put
usercontrol's ID to validateor's "ControlToValidate" property and so far it
seems only server-side validation is working in this case.

Anyway, I think Masudur's suggested approaches are still the preferred ones
here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.
Hi Max,

Have you got any further idea on this or does the information helps you
some? Please feel free to post here if there is anything else we can help.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.

Monday, March 26, 2012

the connection string property has not been initialized

in one of my classes i have a private function, which sets connection
other public shared functions call this connection
when i try to call the public shared functions say to my form code i get that error
any one ever had that beforemake sure that the SQLCommand object's connection property is set to the SQLConnection object:

string connString = "blah"; //insert REAL conn string here
SQLConnection theConnection = new SQLConnection(connString);
SQLCommand theSQLCommand = new SQLCommand();
theSQLCommand.Connection = theConnection; //This line
..
..

The ConnectionString property has not been initialized

Hi, I am trying to run some code I got off from the Quickstart tutorial for connecting to an Access database. I have been attempting several different methods from several different tutorials, none of which have been successful.

Here is the code that I have used which gave me the error: "The ConnectionString property has not been initialized" The complete error message is posted below the code.


<%@dotnet.itags.org. Import Namespace="System.Data" %>
<%@dotnet.itags.org. Import Namespace="System.Data.SqlClient" %
<html>
<script language="VB" runat="server"
Sub Page_Load(Sender As Object, E As EventArgs)

Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter

MyConnection = New SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("PubsString"))
MyCommand = New SqlDataAdapter("select * from Release_of_Information", MyConnection)

DS = new DataSet()
MyCommand.Fill(ds, "Release_of_Information")

MyDataGrid.DataSource=ds.Tables("Release_of_Information").DefaultView
MyDataGrid.DataBind()
End Sub

</script

Below is the complete error message.

I made a change to the web.cnfg file, as is stated below, and all that I got was even less functionality (okay, no functionality) from the webserver.

any ideas ?

The ConnectionString property has not been initialized.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The ConnectionString property has not been initialized.

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

<%@dotnet.itags.org. Page Language="C#" Debug="true" %
or:

2) Add the following section to the configuration file of your application:

<configuration>
<system.web>
<compilation debug="true"/>
</system.web>
</configurationTry adding a Trace.Write (or a response.write) to see what your application sees as the configuration string - like:
Trace.Write("Config = " & ConfigurationSettings.AppSettings("PubsString"))

see what's really happening there - - it looks like, at first glance, that it merely doesn't find a viable connection string there.
Check out this link:

http://www.connectionstrings.com/
With my code now looking like this:

<configuration>
<appSettings>
<add key="PubsString" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\C:\mikep\Career_Start\Career_Start.mdb;User Id=admin;Password=;" />
</appSettings>
<system.web>
<compilation debug="true"/>
</system.web>
</configuration
<%@dotnet.itags.org. Import Namespace="System.Data" %>
<%@dotnet.itags.org. Import Namespace="System.Data.SqlClient" %
<html>
<script language="VB" runat="server"
Sub Page_Load(Sender As Object, E As EventArgs)
Trace.Write("Config = " & ConfigurationSettings.AppSettings("PubsString"))
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter

MyConnection = New SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("PubsString"))
MyCommand = New SqlDataAdapter("select * from Release_of_Information", MyConnection)

DS = new DataSet()
MyCommand.Fill(ds, "Release_of_Information")

MyDataGrid.DataSource=ds.Tables("Release_of_Information").DefaultView
MyDataGrid.DataBind()
End Sub

</script
<body

I am still getting "The ConnectionString property has not been initialized" error message.

I will be glad if I can get beyond this...
your code in web.config looks fine to me just check that you are using the same username and password as you have specified.

Also try changing this the following line:


MyConnection = New SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("PubsString"))

TO

string ConnectionString = (string) ConfigurationSettings.AppSettings["PubsString"];
SqlConnection myConnection = new SqlConnection(ConnectionString);

The ConnectionString property has not been initialized

hi

i'm using the register.aspx just to enter data, and i'm not using the code for cookies so my code when preesing register button (note i'm using instead of customer , auther)

Sub Button1_Click(sender As Object, e As EventArgs)

' Only attempt a login if all form fields on the page are valid

If Page.IsValid = True Then

' Add New Customer to CustomerDB database
Dim accountSystem As ASPNET.StarterKit.Commerce.AutherregisterDB = New ASPNET.StarterKit.Commerce.AutherregisterDB()

Dim Autherid_table as String = accountSystem.AddAuther(Name.Text, Email.Text, Password.Text)

End If

End Sub
and i'm using same classess and declare connection string in webconfig localhost

but i'm getting the error message after filling the register form textboxes

The ConnectionString property has not been initialized.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.InvalidOperationException: The ConnectionString property has not been initialized.
Source Error:

Line 15: Line 16:Line 17: Dim Autherid_table as String = accountSystem.AddAuther(Name.Text, Email.Text, Password.Text)Line 18: Line 19:

Source File:E:\AbdCommerce\Autherregfrm.aspx Line:17
Stack Trace:
[InvalidOperationException: The ConnectionString property has not been initialized.] System.Data.SqlClient.SqlConnection.Open() +432 ASPNET.StarterKit.Commerce.AutherregisterDB.AddAuther(String fullName, String email, String password) +380 ASP.Autherregfrm_aspx.Button1_Click(Object sender, EventArgs e) in E:\AbdCommerce\Autherregfrm.aspx:17 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +83 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain() +1277
is there any idea for the cause??

thanks

When you use web config to store setting strings, you need to import namespace System.Configuration. Why did you see the error on the codeDim Autherid_table as String = accountSystem.AddAuther(Name.Text, Email.Text, Password.Text)?Because the code call a classs that does function to add auther. So, try to go to the class file to add System.Configuration namespace.

The ConnectionString property has not been initialized

Hi all,

I have developed a web page using asp.net. When testing ( debugging ) it from the VS 2005 it works properly.

In the load of the page I created a SqlConnection and specified the ConnectionString

The problem is when calling the page from a Fox Pro 9.0 application I get this message:

The ConnectionString property has not been initialized.

It seems that when calling the page from Fox Pro the ConnectionString is written incorrectly in the load method of the page

So does anyone have any suggestion?

Regards

Could you please specify the connection string over here. Also make sure that you have used new keyword while defining the connection string

Regards,

Suhas


Hi,

There is a article onconnection string here.

The ConnectionString property has not been initialized.

I am trying to use a connection string from web.config file for the first time. Here is my code.

Try
Dim cmd As String = _
("SELECT [Name], BirthDate, StartDate From " & _
"Employees WHERE PayGroup='20' AND Status='A'")

Dim conn As String = _
System.Configuration. _
ConfigurationManager. _
AppSettings("myConString")

Dim myConn As New SqlConnection(conn)
Dim myCmd As New SqlDataAdapter(cmd, myConn)
Dim ds As New DataSet
myCmd.Fill(ds)
gvEmp.DataSource = ds
gvEmp.DataBind()

Catch ex As Exception
Response.Write(ex.Message & "<br>")
Finally

End Try

I am getting The ConnectionString property has not been initialized. What am I doing wrong?Show your web.config code.
<connectionStrings>
<add name="myConString" connectionString="Data Source=myServer;Initial Catalog=Employees;User ID=myUser;Password=mypass"
providerName="System.Data.SqlClient" />
</connectionStrings>

The ConnectionString property has not been initialized.

I have searched the threads for this but nothing seems to answer my questions. I am doing a tutorial

I am getting the error :

The ConnectionString property has not been initialized.

[InvalidOperationException: The ConnectionString property has not been initialized.]
System.Data.SqlClient.SqlConnection.Open() +433
jokepoint.Catalog.GetDepartments() in C:\MyCommerceSite\JokePoint\BusinessObjects\Catalog.vb:11
jokepoint.DepartmentsList.Page_Load(Object sender, EventArgs e) in C:\MyCommerceSite\JokePoint\UserControls\DepartmentsList.ascx.vb:31
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Control.LoadRecursive() +98
System.Web.UI.Control.LoadRecursive() +98
System.Web.UI.Page.ProcessRequestMain() +750

Here are the relevant docs.

web.config

<?xmlversion="1.0"encoding="utf-8"?>
<configuration>
<appSettings>
<addkey="ConnectionString"value="data source=sql3.webcontrolcenter.com; Initial Catalog=dbname;User ID=*******;Password=*******"/>
</appSettings>
<system.web>
<customErrorsmode="Off"/>
<globalizationrequestEncoding="utf-8"responseEncoding="utf-8"/>
</system.web>
</configuration>

Catalog.vb

Imports System.Data.SqlClient

PublicClass Catalog

PublicSharedFunction GetDepartments()As SqlDataReader
' Create the connection object
Dim connectionAsNew SqlConnection("ConnectionString")
' Create and initialize the command object
Dim commandAsNew SqlCommand("GetDepartments", connection)
command.CommandType = CommandType.StoredProcedure
' Open the connection
connection.Open()
' Return a SqlDataReader to the calling function
Return command.ExecuteReader(CommandBehavior.CloseConnection)
EndFunction

PrivateSharedReadOnlyProperty connectionString()AsString
Get
Return ConfigurationSettings.AppSettings("ConnectionString")
EndGet
EndProperty
EndClass

Anyone have any ideas?

Yea- first of all, you are using way way too much excess code...
Try completely removing this:


PrivateSharedReadOnlyProperty connectionString()AsString
Get
Return ConfigurationSettings.AppSettings("ConnectionString")
EndGet
EndProperty
EndClass



And replacing this:


' Create the connection object
Dim connectionAsNew SqlConnection("ConnectionString")


With this:


' Create the connection object
Dim connectionAsNew SqlConnection( ConfigurationSettings.AppSettings("ConnectionString") )


And you should be just fine...

OK Here is the new document. No change. Ideas?

Imports System.Data.SqlClient

PublicClass Catalog

PublicSharedFunction GetDepartments()As SqlDataReader

' Create the connection object

Dim connectionAsNew SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))

' Create and initialize the command object

Dim commandAsNew SqlCommand("GetDepartments", connection)

command.CommandType = CommandType.StoredProcedure

' Open the connection

connection.Open()

' Return a SqlDataReader to the calling function

Return command.ExecuteReader(CommandBehavior.CloseConnection)

EndFunction

EndClass


Hi there,

Are you still getting any error messages ??

If yes, can you post the exact error message

Cheers!

You can see the error yourself here

http://209.200.112.194/default.aspx

Here is a cut and paste

Server Error in '/' Application.

The ConnectionString property has not been initialized.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.InvalidOperationException: The ConnectionString property has not been initialized.
Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:
[InvalidOperationException: The ConnectionString property has not been initialized.] System.Data.SqlClient.SqlConnection.Open() +433 jokepoint.Catalog.GetDepartments() in C:\MyCommerceSite\JokePoint\BusinessObjects\Catalog.vb:11 jokepoint.DepartmentsList.Page_Load(Object sender, EventArgs e) in C:\MyCommerceSite\JokePoint\UserControls\DepartmentsList.ascx.vb:31 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Control.LoadRecursive() +98 System.Web.UI.Control.LoadRecursive() +98 System.Web.UI.Page.ProcessRequestMain() +750


Did you import System.Configuration ?
And what code do you have in your Page_Load?

Here is the situation. I am following a book, "Beginning ASP.NET 1.1 E-Commerce. The book has me working on a local SQL server. I am working remotly and trying to make the changes needed to do it that way.

Instead of posting code I will post a txt version of the docs.

This contains the code for the connection

http://209.200.112.194/txtdocs/catalog.vb.txt

This is a user control code behind

http://209.200.112.194/txtdocs/departmentslist.ascx.vb.txt

this is the user control - view source to see the code

http://209.200.112.194/txtdocs/departmentslist.ascx.txt

web config

http://209.200.112.194/txtdocs/web.config.txt

Help?

Laura K


yea, it's just like I thought. you have to Import System.Configuration into the filehttp://209.200.112.194/txtdocs/catalog.vb.txt

Imports.system.configuration

didn't work


Thats because if you wrote it like that, you didnt write it correctly
In that file the 1st line is:


Imports System.Data.SqlClient


And you just need to add the 2nd line here...


Imports System.Data.SqlClient
Imports System.Configuration



I wrote it correctly in my doc.

Didn't work!


post all of your code in the page that is getting the error so we can see what might be wrong...

LKnomad wrote:

Dim connectionAsNew SqlConnection("ConnectionString")
' Create and initialize the command object
Dim commandAsNew SqlCommand("GetDepartments", connection)
command.CommandType = CommandType.StoredProcedure
' Open the connection
connection.Open()
' Return a SqlDataReader to the calling function
Return command.ExecuteReader(CommandBehavior.CloseConnection)
EndFunction

PrivateSharedReadOnlyProperty connectionString()AsString
Get
Return ConfigurationSettings.AppSettings("ConnectionString")
EndGet
EndProperty
EndClass

Hi,

personally I think you don't access your property the way you coded it.

Try changing this line:

Dim connectionAsNew SqlConnection("ConnectionString")

with this one:

Dim connectionAsNew SqlConnection(connectionString)

Also take a look at this tutorial:Store Your Database Connection String in Web.Config...

Grz, Kris.


The page that is getting the error is the default.aspx page. This page contains a dynamic user control which I believe is the culprit because when I remove this control the page loads. The user control has an ascx and an ascx.vb. I have also posted them. Lastly there is one more doc which has the connection info.

The default page is on the root.

The user control docs are in a folder called UserControls

The doc with the connection info is in a folder called businessObjects.

The web config is on the root.

Here are links to txt files of all the code. Easier to read this way.

Below is the doc in the businessObjects folder containing all the connection info. Notice I have added the imports as suggested.

http://209.200.112.194/txtdocs/catalog.vb.txt

The two docs in the UserControl folder.

http://209.200.112.194/txtdocs/departmentslist.ascx.txt (view source for the full code)

http://209.200.112.194/txtdocs/departmentslist.ascx.vb.txt

Here are the docs on the root. This first doc is the default doc where I am getting the error.

http://209.200.112.194/txtdocs/default.aspx.txt

http://209.200.112.194/txtdocs/default.aspx.vb.txt (code behind)

http://209.200.112.194/txtdocs/web.config.txt (web.config)

I have emailed the author of this tutorial to see if he will offer any support as well.

Thanks

Laura K


Tried the change earlier and tried again just now.

No luck.

Thanks

Laura

The ConnectionString property has not been initialized.

Tried all kinds of things. I get the error.
The ConnectionString property has not been initialized.
Any help appreciated.
----
--
This is the web.config info
<configuration>
<appSettings>
<add key="connectionstring" value="Data Source=path to database;
database=testingsite;User Id=UserID;Password=password" />
</appSettings>
----
----
--
Here is the doc mentioned in the error.
Imports System.Data.SqlClient
Public Class Catalog
Public Shared Function GetDepartments() As SqlDataReader
' Create the connection object
Dim connection As New SqlConnection(connectionString)
' Create and initialize the command object
Dim command As New SqlCommand("dbo.GetDepartments", connection)
command.CommandType = CommandType.StoredProcedure
' Open the connection
connection.Open()
' Return a SqlDataReader to the calling function
Return command.ExecuteReader(CommandBehavior.CloseConnection)
End Function
Private Shared ReadOnly Property connectionString() As String
Get
Return ConfigurationSettings.AppSettings("ConnectionString")
End Get
End Property
End ClassLaura K wrote:
> Tried all kinds of things. I get the error.
> The ConnectionString property has not been initialized.
>
> Any help appreciated.
> ----
--
> This is the web.config info
> <configuration>
> <appSettings>
> <add key="connectionstring" value="Data Source=path to database;
> database=testingsite;User Id=UserID;Password=password" />
> </appSettings>
> ----
----
--
> Here is the doc mentioned in the error.
>
> Imports System.Data.SqlClient
>
> Public Class Catalog
> Public Shared Function GetDepartments() As SqlDataReader
> ' Create the connection object
> Dim connection As New SqlConnection(connectionString)
> ' Create and initialize the command object
> Dim command As New SqlCommand("dbo.GetDepartments", connection)
> command.CommandType = CommandType.StoredProcedure
> ' Open the connection
> connection.Open()
> ' Return a SqlDataReader to the calling function
> Return command.ExecuteReader(CommandBehavior.CloseConnection)
> End Function
> Private Shared ReadOnly Property connectionString() As String
> Get
> Return ConfigurationSettings.AppSettings("ConnectionString")
> End Get
> End Property
> End Class
>
I know the tags are case-sensitive in web.config. Can't remember about
the keys/vals values. Try changing the case sensitivity of your
.AppSettings call or the key name in the config (make them the same).
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
I tried dozen of case changes. That doesn't seem to be it.
Any other ideas?
"Craig Deelsnyder" <cdeelsny@dotnet.itags.org.NO_SPAM_4_MEyahoo.com> wrote in message
news:O4c2gb2UFHA.3584@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
> Laura K wrote:
> I know the tags are case-sensitive in web.config. Can't remember about
> the keys/vals values. Try changing the case sensitivity of your
> .AppSettings call or the key name in the config (make them the same).
> --
> Craig Deelsnyder
> Microsoft MVP - ASP/ASP.NET
Try this:-
<add key="ConnectionString" value="Data Source=(local);
database=Northwind; Integrated Security=SSPI" />
MAKE SURE U ARE PASSING THE CORRECT KEY IN UR APPLICATION.
Patrick
*** Sent via Developersdex http://www.examnotes.net ***
> <add key="connectionstring" value="Data Source=path to database;
> database=testingsite;User Id=UserID;Password=password" />
When this says "path to database", what exactly is the value you're specifyi
ng?
It should be "servername" or "servername\instance".
-Brock
DevelopMentor
http://staff.develop.com/ballen
Patrick Olurotimi Ige wrote:
> Try this:-
> <add key="ConnectionString" value="Data Source=(local);
> database=Northwind; Integrated Security=SSPI" />
> MAKE SURE U ARE PASSING THE CORRECT KEY IN UR APPLICATION.
> Patrick
>
> *** Sent via Developersdex http://www.examnotes.net ***
Heh, I blew right past that part :) Obviously that's pry the problem...
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
When I say path to database it is remote.
sql3.webcontrolcenter.com
"Brock Allen" <ballen@dotnet.itags.org.NOSPAMdevelop.com> wrote in message
news:680347632511475258348832@dotnet.itags.org.msnews.microsoft.com...
> When this says "path to database", what exactly is the value you're
> specifying? It should be "servername" or "servername\instance".
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>
Brock good u figured out that issue ..
And Laura have u finally fixed the connection?
Patrick
*** Sent via Developersdex http://www.examnotes.net ***
Nope connection not fixed. I am also posting this on another forum. Here
is a list of docs. would love to have help. I am totally lost on this one.
Here is the exact same thing as I posted on the other forum. Any help
appreciated.
Here is the situation. I am following a book, "Beginning ASP.NET 1.1
E-Commerce. The book has me working on a local SQL server. I am working
remotly and trying to make the changes needed to do it that way.
Instead of posting code I will post a txt version of the docs.
This contains the code for the connection
http://209.200.112.194/txtdocs/catalog.vb.txt
This is a user control code behind
http://209.200.112.194/txtdocs/depa...ist.ascx.vb.txt
this is the user control - view source to see the code
http://209.200.112.194/txtdocs/departmentslist.ascx.txt
web config
http://209.200.112.194/txtdocs/web.config.txt
Help?
Laura
"Patrick Olurotimi Ige" <naijacoder@dotnet.itags.org.hotmail.com> wrote in message
news:Otxjw$EVFHA.2616@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
> Brock good u figured out that issue ..
> And Laura have u finally fixed the connection?
> Patrick
>
> *** Sent via Developersdex http://www.examnotes.net ***
Laura maybe you can give a try like this:-
Don't use:-
ConfigurationSettings.AppSettings("ConnectionString")
Try including your connectionstring in ur code like:-
Dim connection As New SqlConnection("Data Source=SERVERNAME;Initial
Catalog=YOURDATABASE;User Id=sa;Password=asdasd;")
Hope that helps
** See how it goes**
Patrick
*** Sent via Developersdex http://www.examnotes.net ***

The ConnectionString property has not been initialized.

Tried all kinds of things. I get the error.

The ConnectionString property has not been initialized.

Any help appreciated.

-------------------------------
This is the web.config info

<configuration
<appSettings
<add key="connectionstring" value="Data Source=path to database;
database=testingsite;User Id=UserID;Password=password" /
</appSettings
-------------------------------------------------

Here is the doc mentioned in the error.

Imports System.Data.SqlClient

Public Class Catalog

Public Shared Function GetDepartments() As SqlDataReader

' Create the connection object

Dim connection As New SqlConnection(connectionString)

' Create and initialize the command object

Dim command As New SqlCommand("dbo.GetDepartments", connection)

command.CommandType = CommandType.StoredProcedure

' Open the connection

connection.Open()

' Return a SqlDataReader to the calling function

Return command.ExecuteReader(CommandBehavior.CloseConnect ion)

End Function

Private Shared ReadOnly Property connectionString() As String

Get

Return ConfigurationSettings.AppSettings("ConnectionString")

End Get

End Property

End ClassLaura K wrote:
> Tried all kinds of things. I get the error.
> The ConnectionString property has not been initialized.
>
> Any help appreciated.
> -------------------------------
> This is the web.config info
> <configuration>
> <appSettings>
> <add key="connectionstring" value="Data Source=path to database;
> database=testingsite;User Id=UserID;Password=password" />
> </appSettings>
> -------------------------------------------------
> Here is the doc mentioned in the error.
>
> Imports System.Data.SqlClient
>
> Public Class Catalog
> Public Shared Function GetDepartments() As SqlDataReader
> ' Create the connection object
> Dim connection As New SqlConnection(connectionString)
> ' Create and initialize the command object
> Dim command As New SqlCommand("dbo.GetDepartments", connection)
> command.CommandType = CommandType.StoredProcedure
> ' Open the connection
> connection.Open()
> ' Return a SqlDataReader to the calling function
> Return command.ExecuteReader(CommandBehavior.CloseConnect ion)
> End Function
> Private Shared ReadOnly Property connectionString() As String
> Get
> Return ConfigurationSettings.AppSettings("ConnectionString")
> End Get
> End Property
> End Class

I know the tags are case-sensitive in web.config. Can't remember about
the keys/vals values. Try changing the case sensitivity of your
..AppSettings call or the key name in the config (make them the same).

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
I tried dozen of case changes. That doesn't seem to be it.

Any other ideas?

"Craig Deelsnyder" <cdeelsny@dotnet.itags.org.NO_SPAM_4_MEyahoo.com> wrote in message
news:O4c2gb2UFHA.3584@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
> Laura K wrote:
>> Tried all kinds of things. I get the error.
>>
>> The ConnectionString property has not been initialized.
>>
>>
>>
>> Any help appreciated.
>>
>> -------------------------------
>> This is the web.config info
>>
>> <configuration>
>>
>> <appSettings>
>>
>> <add key="connectionstring" value="Data Source=path to database;
>> database=testingsite;User Id=UserID;Password=password" />
>>
>> </appSettings>
>>
>> -------------------------------------------------
>>
>> Here is the doc mentioned in the error.
>>
>>
>>
>> Imports System.Data.SqlClient
>>
>>
>>
>> Public Class Catalog
>>
>> Public Shared Function GetDepartments() As SqlDataReader
>>
>> ' Create the connection object
>>
>> Dim connection As New SqlConnection(connectionString)
>>
>> ' Create and initialize the command object
>>
>> Dim command As New SqlCommand("dbo.GetDepartments", connection)
>>
>> command.CommandType = CommandType.StoredProcedure
>>
>> ' Open the connection
>>
>> connection.Open()
>>
>> ' Return a SqlDataReader to the calling function
>>
>> Return command.ExecuteReader(CommandBehavior.CloseConnect ion)
>>
>> End Function
>>
>> Private Shared ReadOnly Property connectionString() As String
>>
>> Get
>>
>> Return ConfigurationSettings.AppSettings("ConnectionString")
>>
>> End Get
>>
>> End Property
>>
>> End Class
>>
>>
> I know the tags are case-sensitive in web.config. Can't remember about
> the keys/vals values. Try changing the case sensitivity of your
> .AppSettings call or the key name in the config (make them the same).
> --
> Craig Deelsnyder
> Microsoft MVP - ASP/ASP.NET
Try this:-
<add key="ConnectionString" value="Data Source=(local);
database=Northwind; Integrated Security=SSPI" /
MAKE SURE U ARE PASSING THE CORRECT KEY IN UR APPLICATION.

Patrick

*** Sent via Developersdex http://www.developersdex.com ***
> <add key="connectionstring" value="Data Source=path to database;
> database=testingsite;User Id=UserID;Password=password" /
When this says "path to database", what exactly is the value you're specifying?
It should be "servername" or "servername\instance".

-Brock
DevelopMentor
http://staff.develop.com/ballen
Patrick Olurotimi Ige wrote:
> Try this:-
> <add key="ConnectionString" value="Data Source=(local);
> database=Northwind; Integrated Security=SSPI" />
> MAKE SURE U ARE PASSING THE CORRECT KEY IN UR APPLICATION.
> Patrick
>
> *** Sent via Developersdex http://www.developersdex.com ***

Heh, I blew right past that part :) Obviously that's pry the problem...

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
When I say path to database it is remote.

sql3.webcontrolcenter.com

"Brock Allen" <ballen@dotnet.itags.org.NOSPAMdevelop.com> wrote in message
news:680347632511475258348832@dotnet.itags.org.msnews.microsoft.com ...
>> <add key="connectionstring" value="Data Source=path to database;
>> database=testingsite;User Id=UserID;Password=password" />
> When this says "path to database", what exactly is the value you're
> specifying? It should be "servername" or "servername\instance".
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
Brock good u figured out that issue ..
And Laura have u finally fixed the connection?
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Nope connection not fixed. I am also posting this on another forum. Here
is a list of docs. would love to have help. I am totally lost on this one.

Here is the exact same thing as I posted on the other forum. Any help
appreciated.

Here is the situation. I am following a book, "Beginning ASP.NET 1.1
E-Commerce. The book has me working on a local SQL server. I am working
remotly and trying to make the changes needed to do it that way.

Instead of posting code I will post a txt version of the docs.

This contains the code for the connection

http://209.200.112.194/txtdocs/catalog.vb.txt

This is a user control code behind

http://209.200.112.194/txtdocs/depa...ist.ascx.vb.txt

this is the user control - view source to see the code

http://209.200.112.194/txtdocs/departmentslist.ascx.txt

web config

http://209.200.112.194/txtdocs/web.config.txt

Help?

Laura

"Patrick Olurotimi Ige" <naijacoder@dotnet.itags.org.hotmail.com> wrote in message
news:Otxjw$EVFHA.2616@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
> Brock good u figured out that issue ..
> And Laura have u finally fixed the connection?
> Patrick
>
> *** Sent via Developersdex http://www.developersdex.com ***
Laura maybe you can give a try like this:-
Don't use:-
ConfigurationSettings.AppSettings("ConnectionString")

Try including your connectionstring in ur code like:-

Dim connection As New SqlConnection("Data Source=SERVERNAME;Initial
Catalog=YOURDATABASE;User Id=sa;Password=asdasd;")

Hope that helps
** See how it goes**

Patrick

*** Sent via Developersdex http://www.developersdex.com ***
"Patrick Olurotimi Ige" <naijacoder@dotnet.itags.org.hotmail.com> wrote in message
news:%23c%23Rn4PVFHA.3868@dotnet.itags.org.TK2MSFTNGP14.phx.gbl...
> Laura maybe you can give a try like this:-
> Don't use:-
> ConfigurationSettings.AppSettings("ConnectionString")
> Try including your connectionstring in ur code like:-
> Dim connection As New SqlConnection("Data Source=SERVERNAME;Initial
> Catalog=YOURDATABASE;User Id=sa;Password=asdasd;")
> Hope that helps
> ** See how it goes**
> Patrick
>
>
> *** Sent via Developersdex http://www.developersdex.com ***

Saturday, March 24, 2012

The Ellipsis (.) Character Is Not Showing Up When Read From A Text File

I have a page which reads the the first line of every *.txt file in a
certain directory of mine to use as the Text property of a HyperLink
Control. However, in one of my recently added text files in the directory it
is using all but the ellipsis character (this is the last character in the
line, but it does the same thing when I place the character in other
places). For example, here is what the line looks like in the *.txt file and
the generated HTML code:
*.txt File:
Whate.ver you say.
HTML Code:
Whatever you say
When I create the text files, which I do in Windows Notepad on Windows XP
Pro SP2, I enter the character using the ALT+0133 key combination. Even if
ASP.NET did not recognize this character, I would at least expect it to put
some character in it's place, even if it was not the one I wanted. When
reading the *.txt file I use the System.IO.StreamReader.ReadLine() method. I
am assuming the fix has something to do with the character sets I am using
when creating and/or reading the *.txt files, but I was unable to find the
character set that Notepad saves the file as. Can somebody help me here?
Thanks.
--
Nathan Sokalski
njsokalski@dotnet.itags.org.hotmail.com
http://www.nathansokalski.com/
>but I was unable to find the
>character set that Notepad saves the file as. Can somebody help me here?
The Encoding field in Notepad's File -> Save As... dialog.
Mattias
Mattias Sjgren [C# MVP] mattias @. mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.