.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

How can I refer to a DB connection in WebPart code?

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :SharePoint
 

First off - BCS is not an option in this case -

I've succesfully got webparts built which use code to get data, using a normal connection string.

but after several webparts, it's obvious I need to try a central location for this, and since I'm doing mobile adapters also, from what I understand, using the web.config is not possible in this situation.

So, I've created a Database Connection in SPD....how  can I refer to that, instead of my string, in each section of  code grabbing data?




View Complete Post


More Related Resource Links

Protect It: Safeguard Database Connection Strings and Other Sensitive Settings in Your Code

  

Protecting application secrets, such as database connection strings and passwords, requires careful consideration of a number of pertinent factors such as how sensitive the data is, who could gain access to it, how to balance security, performance, and maintainability, and so forth. This article explains the fundamentals of data protection and compares a variety of techniques that can be used to protect application settings. The author discusses what to avoid, such as hiding keys in source code and the use of Local Security Authority. In addition, he presents some effective solutions such as the Data Protection API.

Alek Davis

MSDN Magazine November 2003


Create a Outlook Task from Custom WebPart in Code

  

Hi

I have a requirement to create a Outlook Task , from a custom webpart through code .

Is this possible?

has any body tried this , if yes can you please give me an insight on how to acheive it.

Some sample Code would be highly appreciated.

Regards

Gaurav


Best way to Deploy InfoPath form with connection information and managed code

  
Hi, Whats the best way to deploy an InfoPath form with connection information and managed code. Is there way I can create a deployment package for this? Thanks in advance, San

How to catch Save Ribbon event from code-behind for the custom webpart

  
Hi there, How can a custom web part(sitting on top of PDP) catch the Save Ribbon event from code? I’ve been looking around for solution, but not yet find one…. Thank you, —JoeJoe

Writing connection string in web.config file by code or dynamically

  
I want to write connection string in web.config file of my application by code. If anyone know the way or code just help me..NET,C#,SQL SERVER

Catch Save Ribbon Event from code-behind for webpart control

  
Hi there, How can a custom web part catch the Save Ribbon event from code-behind? Thank you, —JoeJoe

Catch Save Ribbon Event from code-behind for webpart control

  
Hi there, How can a custom web part catch the Save Ribbon event from code-behind? Thank you, —JoeJoe

Server failed with error code 0xc0000000 to spawn a thread to process a new login or connection

  
Hello All, Suddenly, the sql server is down, in the log file, C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG, I found the record as follows, 2007-03-05 15:40:31.59 Logon       Error: 17189, Severity: 16, State: 1.2007-03-05 15:40:31.59 Logon       SQL Server failed with error code 0xc0000000 to spawn a thread to process a new login or connection. Check the SQL Server error log and the Windows event logs for information about possible related problems. [CLIENT: 172.21.123.48] What else I can do to further investigate? Thanks Spencer

Changing Properties/Attributes of a Webpart in inline code block - Error 'System.Web.UI.WebControl

  
I'm trying this code below, but gettting error: System.Web.UI.WebControls.WebParts.WebPart' does not contain a definition for 'FilterValue1' I need to change the value of the FilterValue1 properties of a content Query WebPart with title = Applicant Files. Thanks in Advance!
protected override void OnLoad(EventArgs e) {  base.OnLoad(e); SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite SiteCollection = new SPSite("https://somesite/")) { SPWeb myWeb = SiteCollection.OpenWeb(); myWeb.AllowUnsafeUpdates = true; Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager mgr = null; mgr = myWeb.GetLimitedWebPartManager("default.aspx",System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared); foreach (System.Web.UI.WebControls.WebParts.WebPart myWebPart in mgr.WebParts) { if (myWebPart.Title == "Applicant Files") { myWebPart.FilterValue1 = "/13"; mgr.SaveChanges(myWebPart); break; } } } }); }

TCP error code 10061: No connection could be made because the target machine actively refused it.

  
I hosted a wcf service application using windows services. When my client (ASP.NET) tries to call the service class hosted by the windows service, I get this error "TCP error code 10061: No connection could be made because the target machine actively refused it. ". Is there a fix for this? The same code works fine if I host it using a console application.

MOSS 2007 Calendar Webpart Source Code

  

Hi,

 

I want to customize an event calendar webpart in MOSS 2007. So I need some help with respect to the source code. I could not find any sample source code for Calendar Webpart in MOSS 2007.

 

Its very urgent. So Please reply for this ..

 

Thanks in Advance,

Ambalavanan


How to wirte the connection code and cofigure SQL Server to use the programe in internet.

  

Hi

I am a bigner

i am using sqlserver 2008

in my computer, sql server name is "LOCALHOET-PC" AND SECOND ONE "LOCALHOST-PC\SQLEXPRESS"

I have write a code in my software like

 

SqlConnection conn;

conn = new SqlConnection("Data Source=LOCALHOST-PC;Initial Catalog=n4netsALT;Integrated Security=sspi");

conn.Open();

 

 

and it is working working smoothly in my computer

MY DOUBT IS

IS THIS CODE WILL WORK IN INETRNET?

OR I SHOULD CHANGE MY SERVER NAME TO SOMTHING OTHER?

PLEASE REPLY ME?

RUPESH B S


How to wirte the connection code and cofigure SQL Server to use the programe in internet.

  

Hi

I am a bigner

i am using sqlserver 2008

in my computer, sql server name is "LOCALHOET-PC" AND SECOND ONE "LOCALHOST-PC\SQLEXPRESS"

I have write a code in my software like

SqlConnection conn;

conn = <

Nested SQLException; SQLState: 08S01 Vendor Code: 0 Message: Connection reset

  
I get this error on my web page whenever i keep open some applications. I browsed through some links which say that it could be a network issue. Though I havn't received any convincing answer though. Any idea why this happens?

SSIS --> Code: 0xC0202070 Source: EnrollmentExport Connection manager "V_FlatFileConn" Descrip

  

I have a SSIS package which is run by Active bactch job daily morning and generate the three text file at different network location. But the sometime the package is failing during the execution with following error message.

" <!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-alt:"Calisto MT"; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-alt:"Times New Roman"; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman";} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-size:10.0pt; mso-ansi-font-size:10.0pt; mso-bidi-font-size:10.0pt;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.0in 1.0in 1.0in; m

How to import SQL Server Reporting Services Report Viewer Webpart on web part Page using code in Sha

  

Hi Every One,

I have use SQL Server Reporting Service in SharePoint integrated mode. I have deployed all reports and data source in SharePoint Document Library using CODE. I need to show those report in “SQL Server Reporting Services Report Viewer” Web Part on Web Part Page, I have created Web Part page by code. But I cannot import this Web Part on Page using Code.

How I can do this by code.

 


Navaratan Sharma

SSPI handshake failed with error code 0x8009030c while establishing a connection with integrated sec

  

Logon Error: 17806, Severity: 20, State: 2.

SSPI handshake failed with error code 0x8009030c while establishing a connection with integrated security; the connection has been closed.

 

We are getting this error daily after i logged in to server.Recently we have created new login.So when login through this new one which is not domain one ,we are facing this problm.

 

kindly help me to remove this error. 


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend