473,657 Members | 2,721 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

when I use webpart, I got sql connection error, what is wrong?

Hi there
I use vs.net 2005 with standard sql 2005 under machine\sql2005 for instant

when I create webpart, the code get from quickstart as follow:

<%@ Page Language="C#" %>
<%@ Register Src="WebPartPag eMenu.ascx" TagName="WebPar tPageMenu" TagPrefix="uc1" %>
<html>
<head id="Head1" runat="server">
<title>Web Part Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:WebPartMan ager ID="WebPartMana ger1" Runat="server"/>
<uc1:webpartpag emenu id="WebPartPage Menu1" runat="server"> </uc1:webpartpage menu>
</div>
<div>
<table style="width: 100%">
<tr>
<td style="width: 100px; height: 100px" valign="top" align="left">
<asp:WebPartZon e ID="WebPartZone 1" Runat="server">
<ZoneTemplate >
<asp:Calendar Runat="server" ID="Calendar1"/>
</ZoneTemplate>
</asp:WebPartZone >
</td>
<td style="width: 100px; height: 100px" valign="top" align="left">
<asp:WebPartZon e ID="WebPartZone 2" Runat="server">
</asp:WebPartZone >
</td>
<td style="width: 100px; height: 100px" valign="top" align="left">
</td>
</tr>
</table>
<br />
<asp:LoginStatu s ID="LoginStatus 1" Runat="server" />
</div>
</form>
</body>
</html>
------------------------------------------------------------------------------------------------------------------
<%@ Control Language="C#" ClassName="WebP artPageMenu" %>
<script runat="server">
// Use a field to reference the current WebPartManager.
WebPartManager _manager;
void Page_Init(objec t sender, EventArgs e)
{
Page.InitComple te += new EventHandler(In itComplete);
}
void InitComplete(ob ject sender, System.EventArg s e)
{
_manager = WebPartManager. GetCurrentWebPa rtManager(Page) ;
String browseModeName = WebPartManager. BrowseDisplayMo de.Name;
// Fill the dropdown with the names of supported display modes.
foreach (WebPartDisplay Mode mode in _manager.Suppor tedDisplayModes )
{
String modeName = mode.Name;
// Make sure a mode is enabled before adding it.
if (mode.IsEnabled (_manager))
{
ListItem item = new ListItem(modeNa me , modeName);
DisplayModeDrop down.Items.Add( item);
}
}
}

// Change the page to the selected display mode.
void DisplayModeDrop down_SelectedIn dexChanged(obje ct sender,
EventArgs e)
{
String selectedMode = DisplayModeDrop down.SelectedVa lue;
WebPartDisplayM ode mode = _manager.Suppor tedDisplayModes[selectedMode];
if (mode != null)
_manager.Displa yMode = mode;
}
void Page_PreRender( object sender, EventArgs e)
{
DisplayModeDrop down.SelectedVa lue = _manager.Displa yMode.Name;
}

</script>
<div>
<asp:DropDownLi st ID="DisplayMode Dropdown"
runat="server"
AutoPostBack="t rue"
EnableViewState ="false"
OnSelectedIndex Changed="Displa yModeDropdown_S electedIndexCha nged" />
</div>
--------------------------------------------------------------------------------------------------------------------------------------------
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)
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.

SQLExpress database file auto-creation error:
The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:
1.. If the applications App_Data directory does not already exist, the web server account must have read and write access to the applications directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist.
2.. If the applications App_Data directory already exists, the web server account only requires read and write access to the applications App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the applications App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server accounts credentials are used when creating the new database.
3.. Sql Server Express must be installed on the machine.
4.. The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.
how can I solve this problem? where I need to set up sql connection(I can't find it any where)? I create gradview and it is working to get data from sql 2005 with connection string

Thanks

Tony Dong
Dec 15 '05 #1
0 4341

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1201
by: J. Jespersen | last post by:
Hi people, I fiddling with webparts, and have created my own custom webpart from scratch. The webpart itself is contained in a myPart.dll I have two different sites. SiteA and SiteB. Both are webparts-based. I have added the webpart to my toolbox, and added it to a declarativeCatalogPart, and finally added the webpart to a webPartZone. No problemo. I have allowed the webpart for export, and have exported it to a
1
1299
by: Michael | last post by:
Hi, Is there a way to write some code to do some stuffs after a WebPart has been closed? I want to store the state of the WebPart in the user's profile so that I can determine if a particular WebPart is "visible" or not from other Web pages. Thanks, Michael
0
1077
by: arthernan | last post by:
If I separate the code into two buttons on a web page it works. One button creates the webpart and the second creates the connection. But the minute I move the connection creation code to the web part creation, I get a webpart does not belong to this page. I can appreciate how the webparts may not be ready for the connections. How do I make them ready on the same event? I don't want to have users clicking two buttons to open two...
0
1611
by: Vaibhav Shah | last post by:
Hi, While loading a user control with IE WebControl's tree view in it, on a webpart, i am getting this error. Error: unable to load ~\UserControls\TreeViewControl.ascx Details: Parser Error: Could not load type Microsoft.Web.UI.WebControls.Design.CssCollectionEditor from assembly mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
0
1302
by: jademoon | last post by:
I have posted this message to the SharePoint.PortalServer group and the SharePoint.PortalServer.Development group and did receive any responses, so I suspect I was posting to the wrong groups. I hope that this group can help with the following: The Envrionment (both of these servers are in our DMZ): One Server: OS: Win2k3 Standard Ed.(SP1) SharePoint Portal Server 2003
0
1034
by: Kieran | last post by:
I've created a few simple webparts and they work fine. I have now created a customised TreeView webpart (it is populated by a xml file description of a directory on disk). It renders okay but when you click on a Node (dynamic populate = true) to view the contents of a folder, you get a Javascript error "object expected". Having done some investigation and comparing it using the same custom control but created at compile time on the page,...
0
4034
by: Christof Nordiek | last post by:
Hi, I want to create a WebPart, that shows a TreeView. So i created a class that derives from WebPart created an TreeView control therein and added it to the Controls collection. I also added some root and child nodes. The TreeView shows up in the WebPart allright and if I set the Expanded property to true ot shows expanded. So far so good. The only problem is, the expand / collaps buttons don't work. It shows "error on the page" in...
2
1615
by: skneife | last post by:
I need to create some zones in my asp page, that contains a header and a body like a webpart. How can I use a webpart for this designed without any webpart menu or connection with anything, like a stand alone control ? Thanks. Sam
0
1106
by: vegetable21 | last post by:
Hi all, I've been having an issue with my webparts for some time now, i'll try and explain it as best as i can: ASP.NET website using webparts and forms authentication. Multiple custom webparts built using ascx and extending the webpart class. User settings stored in Personalisation database. Using the WebPartManager in Microsoft.Web.Preview Using a custom derived CatalogZone
0
8382
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8717
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8600
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7311
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5629
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1930
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1600
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.