473,396 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

appsetting

hi
my problems is that is creat this type of appsettings
<appSettings>
<add Key="Sparsh2008" value="server=(HOME); database=Sparsh2008;Integrated Security= SSPI" />
</appSettings>
then call the app valu at button event like this

string Sparsh2008=ConfigurationSettings.AppSettings["Sparsh2008"];

using(SqlConnection myConnection =new SqlConnection (Sparsh2008))

myConnection.Open();

SqlCommand inserdCmd=new SqlCommand("SP_INSERT_telecallar");
inserdCmd.CommandType=CommandType.StoredProcedure;

// inserdCmd.Parameters.Add(new SqlParameter("@TeleCallarID",SqlDbType.VarChar,10) );
inserdCmd.Parameters.Add (new SqlParameter ("@TeleCallarName",SqlDbType.VarChar,25));
inserdCmd.Parameters.Add (new SqlParameter ("@SalesPersonName",SqlDbType.VarChar,25));
inserdCmd.Parameters.Add (new SqlParameter ("@MobileNo",SqlDbType.VarChar,11));


// inserdCmd.Parameters["@TeleCallarID"].Value=txttelecallerid.Text;
inserdCmd.Parameters["@TeleCallarName"].Value=txttcal.Text;
inserdCmd.Parameters["@SalesPersonName"].Value=txtsalpername.Text;
inserdCmd.Parameters["@MobileNo"].Value=txtnumber.Text;


inserdCmd.ExecuteNonQuery ();
{
lblmessage.Text=("data saved");
lblmessage.Visible=true;


}


also open the using System.Configuration; at upper side of form
but i have recive error like

Required attribute 'key' not found
pls solve this proble

thanks
jayanta sarkar
Mar 6 '08 #1
1 1416
kenobewan
4,871 Expert 4TB
Here is an article that may help:
Using connection strings from web.config in ASP.NET v2.0
Mar 6 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ellis Yu | last post by:
Dear All, I use function configurationsettings.appsetting to retrieve the connection string value which stored in a file app.config. At the beginning, it's fine that it can pick up the value...
2
by: keith | last post by:
In my app, an executable (app.exe) calls functions from an assembly dll (subapp.dll). app.exe has config file: app.exe.config <?xml version="1.0" encoding="utf-8" ?> <configuration>...
1
by: Maziar Aflatoun | last post by:
Hi everyone, I'm tring to read the appSettings from my Web.config file in Visual Studio.Net (Code behind page) and it doesn't recognize ConfigurationSettings.AppSetting? Yet it works in my .aspx...
0
by: Amy | last post by:
I have: <appSettings> <add key="LeadTrackSQL" value="User ID=sa;Pwd=password;Initial Catalog=DCLeadTrack;Data Source=localhost" /> </appSettings> That value displayed at the top of a page...
2
by: John Spiegel | last post by:
Hi all, I'm looking for suggestions on storing classifications of application settings in a WinForms app. I've got a couple ideas using XML config files. One is to have a set of .config files...
6
by: Mats-Lennart Hansson | last post by:
Hi, In a windows service, I have some appSettings. If I during runtime changes one of the values, is it availabele to the service from that moment? Or do I have to restart the service before I can...
1
by: softwareakash | last post by:
Hi I have a class library which takes some values from web config / app config files when called. I am initialising these values when my object gets called. Is there any method to find out if...
16
by: Robert Dufour | last post by:
Here's the class code snippet Imports System.Configuration.ConfigurationManager Public Class Class1 Public _strTestSetting As String Public Sub SetTestsetting()
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.