|
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"))<br />
Dim MyCmd As New SqlCommand("sp_ValidateUser", MyConn)<br />
MyCmd.CommandType = CommandType.StoredProcedure<br />
Dim objParam1, objParam2 As SqlParameter<br />
objParam1 = MyCmd.Parameters.Add("@noPekerja", SqlDbType.VarChar)<br />
objParam2 = MyCmd.Parameters.Add("@pWord", SqlDbType.VarChar)<br />
objParam1.Direction = ParameterDirection.Input<br />
objParam2.Direction = ParameterDirection.Input<br />
objParam1.Value = textUsername.Text<br />
objParam2.Value = passwordTextBox.Text<br />
Try<br />
If MyConn.State = ConnectionState.Closed Then<br />
MyConn.Open()<br />
End If<br />
Dim objReader As Data.SqlClient.SqlDataReader<br />
objReader = MyCmd.ExecuteReader(CommandBehavior.CloseConnection)<br />
Catch ex As Exception<br />
lblMessage.Text = "Error Connecting to Database!"<br />
End Try<br />
<br />
please help me?
|
|
|
|
|
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
|
|
|
|
|
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?
|
|
|
|
|
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
|
|
|
|
|
do i need a datatable adapter with it?i dun know how to used it?
|
|
|
|
|
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
|
|
|
|
|
in my web config :
<add name="psmConnectionString2" connectionstring="Data Source=HAPPYFAM-B614E1\SQLEXPRESS;Initial Catalog=psm;Integrated Security=True"
="" providername="System.Data.SqlClient">
how can i print the psmConnectionString2 and Check ,If It's giving error or not?
|
|
|
|
|
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
|
|
|
|
|
i cant understand what did u mean?could u show my what ur web config look like.
|
|
|
|
|
This is my web.config file
<configuration>
<appsettings>
<add key="connstring" value="data source=192.168.0.18;database=ABDATABASE;user id=sa; password=;">
<system.web>
<compilation
="" defaultlanguage="c#" debug="true">
<customerrors mode="Off">
<error statuscode="404" redirect="errormsg.aspx">
<authentication mode="Windows">
<authorization>
<allow users="*">
<trace
enabled="false"
="" requestlimit="10" pageoutput="false" tracemode="SortByTime" localonly="true">
<sessionstate
="" mode="InProc" stateconnectionstring="tcpip=127.0.0.1:42424" sqlconnectionstring="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20">
<globalization
="" requestencoding="utf-8" responseencoding="utf-8">
Senior Software Engineer
Nothing is Impossible Even Impossible says I'MPOSSSIBLE
|
|
|
|
|
where did u specified ur connection string?
|
|
|
|
|
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
|
|
|
|
|
<add key="psmConnectionString2" value="server=ServerName;database=DataBase;uid=sa;pwd=sa;">
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
|
|
|
|
|
it return nuthing.the page when blank.whats wrong?
|
|
|
|
|
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
<add key="strCon" value="server=Name/IP;database=DBName;uid=sa;pwd=sa;">
here strCon is My connection stirng
Senior Software Engineer
Nothing is Impossible Even Impossible says I'MPOSSSIBLE
|
|
|
|
|
could u show me one of ur example?
|
|
|
|
|
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; }
|
|
|
|
|
where should i change.is it in the web config?
|
|
|
|
|
Yes.
---
b { font-weight: normal; }
|
|
|
|
|
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"<br />
providerName="System.Data.SqlClient" <br />
-- modified at 4:06 Wednesday 1st March, 2006
|
|
|
|
|
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; }
|
|
|
|
|
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
|
|
|
|
|
I'm a beginner of VB and using VB6 now.
I know VB can use DLL developed by VC, but can VB use static library? and how?
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
I write a function in VC just like this:
int add(int a)
{
return ++a;
}
then I get a file named LibTest.lib.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
I put LibTest.lib under the directory of VB project and write these code in the form code view.
Option Explicit
Private Declare Function add Lib "LibTest.lib" (ByVal a As Integer) As Integer
Private Sub Form_Load()
Print add(5)
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
but when I execute this project, it tells me "Run-time error ‘53’,file not found: LibTest.lib", why?
hello guys!
|
|
|
|
|
superSYNC wrote: I know VB can use DLL developed by VC, but can VB use static library? and how?
The quick answer is No. VB cannot use static libraries.
...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
|
|
|
|
|