Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 11th, 2007, 01:20 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default Connection string

hello to all

i am using sql helper class. while executing the sql insert statement i am writing the syntax as

SqlHelper.ExecuteNonQuery(ConfigurationSettings.Ap pSettings["ConnectionString"], CommandType.Text, sqlInsert);

my this query goes to sql helper class there i found i am not getting the value of connection string which is in web.config file.

please guide me what i am writing wrong as i am not passing the connection string.

my query is right as well as i am not getting the ConfigurationManager.Appsetting in my intellisense.



regards,

Munish Bhatia



thanks......
__________________
thanks......
 
Old May 11th, 2007, 05:36 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
quote: am not getting the ConfigurationManager.Appsetting in my intellisense.
import the namespace as
using System.Configuration;

Regarding not getting web.config value, please check for exact name in the web.config file...



Regards
Mike

Fortune favours the brave, so don't regret on missed oppurtunities.
 
Old May 15th, 2007, 02:03 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

hello mike thanks to suggest. i found my problem as i was using wrong syntax.i am to use:
ConfigurationManager.Connectionstring..........

thanks


thanks......
 
Old May 15th, 2007, 03:15 AM
Registered User
 
Join Date: Feb 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to condescendent Send a message via Yahoo to condescendent
Default

I have a good example for ConfigurationManager.Connectionstring..........

it's correct and you can read for experience.


<WebMethod()> _
    Public Function getPrice(ByVal productid As Integer) As DataSet

        Dim conn As New Data.SqlClient.SqlConnection(ConfigurationManager. ConnectionStrings("AdventureWorksConnectionString" ).ConnectionString.ToString())
        Dim myDataAdapter As SqlDataAdapter
        Dim myDataSet As DataSet
        Dim cmdString As String = "Select ListPrice From Production.Product where Production.Product.ProductID =" & productid



        myDataAdapter = New SqlDataAdapter(cmdString, conn)

        myDataSet = New DataSet()
        myDataAdapter.Fill(myDataSet, "Price")


        'price = datareader

        'conn = New SqlConnection("Server=localhost; uid=sa; pdw= ; database=AdventureWorks ")


        'Page(1029)


        Return myDataSet
    End Function


I am a database programmer and .Net programmer
 
Old May 16th, 2007, 05:50 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thanks for a example.

thanks......





Similar Threads
Thread Thread Starter Forum Replies Last Post
Connection String jmss66 Oracle 4 August 8th, 2006 03:19 AM
Connection String slgknjn VB Databases Basics 2 February 26th, 2005 03:14 AM
Connection String fs22 Classic ASP Databases 3 August 30th, 2004 01:25 AM
Connection string tlamazares SQL Server ASP 1 March 29th, 2004 05:16 PM
Connection String Help. diamond2165 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 November 7th, 2003 06:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.