Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. whats wrong wif my connection?

whats wrong wif my connection?

Scheduled Pinned Locked Moved Visual Basic
helpdatabasequestion
22 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Steve Pullan

    pandapatin wrote:

    whats wrong wif my connection?

    Mebbe u spel it wong?

    pandapatin wrote:

    Keyword not supported: 'happyfam-b614e1\sqlexpress;initial catalog'.

    The error message is telling you what the problem is - you have a misconstructed connection string with what it thinks is an invalid keyword for the connection being attempted. ...Steve "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once :-)

    P Offline
    P Offline
    pandapatin
    wrote on last edited by
    #3

    the spelling is ok,i've double check it.it is the same as my connection string as it in my web config file.So anything i can do to solve it?

    S 1 Reply Last reply
    0
    • P pandapatin

      the spelling is ok,i've double check it.it is the same as my connection string as it in my web config file.So anything i can do to solve it?

      S Offline
      S Offline
      Steve Pullan
      wrote on last edited by
      #4

      pandapatin wrote:

      the spelling is ok,i've double check it.it is the same as my connection string as it in my web config file.So anything i can do to solve it?

      Dim MyConn As New SqlConnection(ConfigurationManager.AppSettings("psmConnectionString2"))
      

      This is the line it is crashing on right? Make sure that whatever psmConnectionString2 contains is in the correct format and properly constructed. Hint: Put the cursor on SqlConnection in the line above (in Visual Studio) and press F1. ...Steve "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once :-)

      P 1 Reply Last reply
      0
      • S Steve Pullan

        pandapatin wrote:

        the spelling is ok,i've double check it.it is the same as my connection string as it in my web config file.So anything i can do to solve it?

        Dim MyConn As New SqlConnection(ConfigurationManager.AppSettings("psmConnectionString2"))
        

        This is the line it is crashing on right? Make sure that whatever psmConnectionString2 contains is in the correct format and properly constructed. Hint: Put the cursor on SqlConnection in the line above (in Visual Studio) and press F1. ...Steve "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once :-)

        P Offline
        P Offline
        pandapatin
        wrote on last edited by
        #5

        do i need a datatable adapter with it?i dun know how to used it?

        H 1 Reply Last reply
        0
        • P pandapatin

          do i need a datatable adapter with it?i dun know how to used it?

          H Offline
          H Offline
          HimaBindu Vejella
          wrote on last edited by
          #6

          Your code is correct May be u r wrong in placing the right connection string In ur web.config what's the code that u r using for assigning psmConnectionString2 Just print psmConnectionString2 and Check ,If It's giving error or not Nothing is Impossible Even Impossible says I'MPOSSSIBLE

          P 1 Reply Last reply
          0
          • H HimaBindu Vejella

            Your code is correct May be u r wrong in placing the right connection string In ur web.config what's the code that u r using for assigning psmConnectionString2 Just print psmConnectionString2 and Check ,If It's giving error or not Nothing is Impossible Even Impossible says I'MPOSSSIBLE

            P Offline
            P Offline
            pandapatin
            wrote on last edited by
            #7

            in my web config : how can i print the psmConnectionString2 and Check ,If It's giving error or not?

            H 1 Reply Last reply
            0
            • P pandapatin

              the error is : Keyword not supported: 'happyfam-b614e1\sqlexpress;initial catalog'. it return nuthing to the connection.the code us : Dim MyConn As New SqlConnection(ConfigurationManager.AppSettings("psmConnectionString2")) Dim MyCmd As New SqlCommand("sp_ValidateUser", MyConn) MyCmd.CommandType = CommandType.StoredProcedure Dim objParam1, objParam2 As SqlParameter objParam1 = MyCmd.Parameters.Add("@noPekerja", SqlDbType.VarChar) objParam2 = MyCmd.Parameters.Add("@pWord", SqlDbType.VarChar) objParam1.Direction = ParameterDirection.Input objParam2.Direction = ParameterDirection.Input objParam1.Value = textUsername.Text objParam2.Value = passwordTextBox.Text Try If MyConn.State = ConnectionState.Closed Then MyConn.Open() End If Dim objReader As Data.SqlClient.SqlDataReader objReader = MyCmd.ExecuteReader(CommandBehavior.CloseConnection) Catch ex As Exception lblMessage.Text = "Error Connecting to Database!" End Try please help me?

              H Offline
              H Offline
              HimaBindu Vejella
              wrote on last edited by
              #8

              Is this your connection string or some other Just print using lblMessage.Text =ConfigurationManager.AppSettings("psmConnectionString2")); Response.End(); If ur label gets the Connection string value u have declared then ur connection string and D connection is correct Other wise problem with connection string declaration /DB Connection Senior Software Engineer Nothing is Impossible Even Impossible says I'MPOSSSIBLE

              P 1 Reply Last reply
              0
              • H HimaBindu Vejella

                Is this your connection string or some other Just print using lblMessage.Text =ConfigurationManager.AppSettings("psmConnectionString2")); Response.End(); If ur label gets the Connection string value u have declared then ur connection string and D connection is correct Other wise problem with connection string declaration /DB Connection Senior Software Engineer Nothing is Impossible Even Impossible says I'MPOSSSIBLE

                P Offline
                P Offline
                pandapatin
                wrote on last edited by
                #9

                it return nuthing.the page when blank.whats wrong?

                H 1 Reply Last reply
                0
                • P pandapatin

                  it return nuthing.the page when blank.whats wrong?

                  H Offline
                  H Offline
                  HimaBindu Vejella
                  wrote on last edited by
                  #10

                  That means that u are not getting ur connection string in the label So problem with connection string Have u delclatred it like this or not here strCon is My connection stirng Senior Software Engineer Nothing is Impossible Even Impossible says I'MPOSSSIBLE

                  P 1 Reply Last reply
                  0
                  • P pandapatin

                    the error is : Keyword not supported: 'happyfam-b614e1\sqlexpress;initial catalog'. it return nuthing to the connection.the code us : Dim MyConn As New SqlConnection(ConfigurationManager.AppSettings("psmConnectionString2")) Dim MyCmd As New SqlCommand("sp_ValidateUser", MyConn) MyCmd.CommandType = CommandType.StoredProcedure Dim objParam1, objParam2 As SqlParameter objParam1 = MyCmd.Parameters.Add("@noPekerja", SqlDbType.VarChar) objParam2 = MyCmd.Parameters.Add("@pWord", SqlDbType.VarChar) objParam1.Direction = ParameterDirection.Input objParam2.Direction = ParameterDirection.Input objParam1.Value = textUsername.Text objParam2.Value = passwordTextBox.Text Try If MyConn.State = ConnectionState.Closed Then MyConn.Open() End If Dim objReader As Data.SqlClient.SqlDataReader objReader = MyCmd.ExecuteReader(CommandBehavior.CloseConnection) Catch ex As Exception lblMessage.Text = "Error Connecting to Database!" End Try please help me?

                    G Offline
                    G Offline
                    Guffa
                    wrote on last edited by
                    #11

                    The error is in your connection string, no the code. The format of the connection string is "keyword=value;keyword=value;...;keyword=value". What you have put in the connection sting does not follow this syntax. --- b { font-weight: normal; }

                    P 1 Reply Last reply
                    0
                    • H HimaBindu Vejella

                      That means that u are not getting ur connection string in the label So problem with connection string Have u delclatred it like this or not here strCon is My connection stirng Senior Software Engineer Nothing is Impossible Even Impossible says I'MPOSSSIBLE

                      P Offline
                      P Offline
                      pandapatin
                      wrote on last edited by
                      #12

                      could u show me one of ur example?

                      1 Reply Last reply
                      0
                      • G Guffa

                        The error is in your connection string, no the code. The format of the connection string is "keyword=value;keyword=value;...;keyword=value". What you have put in the connection sting does not follow this syntax. --- b { font-weight: normal; }

                        P Offline
                        P Offline
                        pandapatin
                        wrote on last edited by
                        #13

                        where should i change.is it in the web config?

                        G 1 Reply Last reply
                        0
                        • P pandapatin

                          where should i change.is it in the web config?

                          G Offline
                          G Offline
                          Guffa
                          wrote on last edited by
                          #14

                          Yes. --- b { font-weight: normal; }

                          P 1 Reply Last reply
                          0
                          • G Guffa

                            Yes. --- b { font-weight: normal; }

                            P Offline
                            P Offline
                            pandapatin
                            wrote on last edited by
                            #15

                            there is an error: Unrecognized attribute 'keyword'. Note that attribute names are case-sensitive. the code is: add keyword="name=psmConnectionString2" keyword1="connectionString=Data Source=HAPPYFAM-B614E1\SQLEXPRESS;Initial Catalog=psm;Integrated Security=True" providerName="System.Data.SqlClient" -- modified at 4:06 Wednesday 1st March, 2006

                            G 1 Reply Last reply
                            0
                            • P pandapatin

                              in my web config : how can i print the psmConnectionString2 and Check ,If It's giving error or not?

                              H Offline
                              H Offline
                              HimaBindu Vejella
                              wrote on last edited by
                              #16

                              in my web config : providerName="System.Data.SqlClient" /> It's not a valid connection string declaration Please declare a vlaid connection string by generating connection string through typed dataset Senior Software Engineer Nothing is Impossible Even Impossible says I'MPOSSSIBLE

                              P 1 Reply Last reply
                              0
                              • H HimaBindu Vejella

                                in my web config : providerName="System.Data.SqlClient" /> It's not a valid connection string declaration Please declare a vlaid connection string by generating connection string through typed dataset Senior Software Engineer Nothing is Impossible Even Impossible says I'MPOSSSIBLE

                                P Offline
                                P Offline
                                pandapatin
                                wrote on last edited by
                                #17

                                i cant understand what did u mean?could u show my what ur web config look like.

                                H 2 Replies Last reply
                                0
                                • P pandapatin

                                  i cant understand what did u mean?could u show my what ur web config look like.

                                  H Offline
                                  H Offline
                                  HimaBindu Vejella
                                  wrote on last edited by
                                  #18

                                  This is my web.config file

                                  P 1 Reply Last reply
                                  0
                                  • P pandapatin

                                    i cant understand what did u mean?could u show my what ur web config look like.

                                    H Offline
                                    H Offline
                                    HimaBindu Vejella
                                    wrote on last edited by
                                    #19

                                    My Web.Config file configuration appSettings add key="connstring" value="data source=192.168.0.18;database=ABDATABASE;user id=sa; password=; appSettings system.web Senior Software Engineer Nothing is Impossible Even Impossible says I'MPOSSSIBLE -- modified at 4:30 Wednesday 1st March, 2006

                                    1 Reply Last reply
                                    0
                                    • H HimaBindu Vejella

                                      This is my web.config file

                                      P Offline
                                      P Offline
                                      pandapatin
                                      wrote on last edited by
                                      #20

                                      where did u specified ur connection string?

                                      1 Reply Last reply
                                      0
                                      • P pandapatin

                                        there is an error: Unrecognized attribute 'keyword'. Note that attribute names are case-sensitive. the code is: add keyword="name=psmConnectionString2" keyword1="connectionString=Data Source=HAPPYFAM-B614E1\SQLEXPRESS;Initial Catalog=psm;Integrated Security=True" providerName="System.Data.SqlClient" -- modified at 4:06 Wednesday 1st March, 2006

                                        G Offline
                                        G Offline
                                        Guffa
                                        wrote on last edited by
                                        #21

                                        The attribute names in the tag shold be "key" and "value", not "keyword", "keyword1" and "providerName". Remove "connectionString=" from your connection string. Remove the providerName attribute. --- b { font-weight: normal; }

                                        1 Reply Last reply
                                        0
                                        • P pandapatin

                                          the error is : Keyword not supported: 'happyfam-b614e1\sqlexpress;initial catalog'. it return nuthing to the connection.the code us : Dim MyConn As New SqlConnection(ConfigurationManager.AppSettings("psmConnectionString2")) Dim MyCmd As New SqlCommand("sp_ValidateUser", MyConn) MyCmd.CommandType = CommandType.StoredProcedure Dim objParam1, objParam2 As SqlParameter objParam1 = MyCmd.Parameters.Add("@noPekerja", SqlDbType.VarChar) objParam2 = MyCmd.Parameters.Add("@pWord", SqlDbType.VarChar) objParam1.Direction = ParameterDirection.Input objParam2.Direction = ParameterDirection.Input objParam1.Value = textUsername.Text objParam2.Value = passwordTextBox.Text Try If MyConn.State = ConnectionState.Closed Then MyConn.Open() End If Dim objReader As Data.SqlClient.SqlDataReader objReader = MyCmd.ExecuteReader(CommandBehavior.CloseConnection) Catch ex As Exception lblMessage.Text = "Error Connecting to Database!" End Try please help me?

                                          J Offline
                                          J Offline
                                          Jai Mataji
                                          wrote on last edited by
                                          #22

                                          pandapatin wrote:

                                          Dim MyConn As New SqlConnection(ConfigurationManager.AppSettings("psmConnectionString2"))

                                          Can you paste the value for the key psmConnectionString2 in Web.config to obtain better picture. Sneha

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups