Showing posts with label string. Show all posts
Showing posts with label string. Show all posts

Friday, March 30, 2012

MS sql sever connection string

Hi everybody
Can anybody write a code and tell me how can i access a table called
KF_STATUS which is stored in MS SQL server2000. and it thas 3 fields called
KF_ID ,KF_DATE, and KF_STATUS and how can i display contents of those fields
--
Message posted via http://www.sqlmonster.comHi,
Access the table:-
1. Login to QUERY analyzer by providing the user name password
2. From the database pane, select the database where the KF_STATUS table
resides
3. Write the below query
select KF_ID ,KF_DATE, KF_STATUS FROM KF_STATUS
4. Execute the query by pressing Control and E simulteneously. This will
give u result.
THnaks
Hari
SQL Server MVP
"gurvinder gill via SQLMonster.com" <forum@.nospam.SQLMonster.com> wrote in
message news:f68623ec640847c497a4e72817032580@.SQLMonster.com...
> Hi everybody
> Can anybody write a code and tell me how can i access a table called
> KF_STATUS which is stored in MS SQL server2000. and it thas 3 fields
> called
> KF_ID ,KF_DATE, and KF_STATUS and how can i display contents of those
> fields
> --
> Message posted via http://www.sqlmonster.com

MS sql sever connection string

Hi everybody
Can anybody write a code and tell me how can i access a table called
KF_STATUS which is stored in MS SQL server2000. and it thas 3 fields called
KF_ID ,KF_DATE, and KF_STATUS and how can i display contents of those fields
Message posted via http://www.droptable.comHi,
Access the table:-
1. Login to QUERY analyzer by providing the user name password
2. From the database pane, select the database where the KF_STATUS table
resides
3. Write the below query
select KF_ID ,KF_DATE, KF_STATUS FROM KF_STATUS
4. Execute the query by pressing Control and E simulteneously. This will
give u result.
THnaks
Hari
SQL Server MVP
"gurvinder gill via droptable.com" <forum@.nospam.droptable.com> wrote in
message news:f68623ec640847c497a4e72817032580@.SQ
droptable.com...
> Hi everybody
> Can anybody write a code and tell me how can i access a table called
> KF_STATUS which is stored in MS SQL server2000. and it thas 3 fields
> called
> KF_ID ,KF_DATE, and KF_STATUS and how can i display contents of those
> fields
> --
> Message posted via http://www.droptable.comsql

Wednesday, March 28, 2012

MS sql sever connection string

Hi everybody
Can anybody write a code and tell me how can i access a table called
KF_STATUS which is stored in MS SQL server2000. and it thas 3 fields called
KF_ID ,KF_DATE, and KF_STATUS and how can i display contents of those fields
Message posted via http://www.droptable.com
Hi,
Access the table:-
1. Login to QUERY analyzer by providing the user name password
2. From the database pane, select the database where the KF_STATUS table
resides
3. Write the below query
select KF_ID ,KF_DATE, KF_STATUS FROM KF_STATUS
4. Execute the query by pressing Control and E simulteneously. This will
give u result.
THnaks
Hari
SQL Server MVP
"gurvinder gill via droptable.com" <forum@.nospam.droptable.com> wrote in
message news:f68623ec640847c497a4e72817032580@.droptable.co m...
> Hi everybody
> Can anybody write a code and tell me how can i access a table called
> KF_STATUS which is stored in MS SQL server2000. and it thas 3 fields
> called
> KF_ID ,KF_DATE, and KF_STATUS and how can i display contents of those
> fields
> --
> Message posted via http://www.droptable.com

MS SQL sever 2000 string connection problem

Hi, i'm very new to Web Matrix. I've been following the C# end-end application tutorial exactly but i can't seem to run my application.
The code given in the link below is for MS Access but I'm using MS SQL 2000, so i'm not sure of the syntax for the code provided below (string connectionString...)
Please help..thank u!!

http://www.asp.net/webmatrix/guidedtour/section91/bookrequestcontrol.aspx

string connectionString = @."Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\TempProjects\LibraryDatabase.mdb";

public void LoadRequestedBooks(){

try

{

string mySelectQuery = string.Format("SELECT books.* from books, requests where books.bid = requests.bid and requests.mid = {0}", Session["userid"]);

System.Data.OleDb.OleDbConnection myConnection = new System.Data.OleDb.OleDbConnection(connectionString);

System.Data.DataSet myDataSet = new System.Data.DataSet();

System.Data.OleDb.OleDbDataAdapter myOleDbDataAdapter = new System.Data.OleDb.OleDbDataAdapter(mySelectQuery, myConnection);

myOleDbDataAdapter.Fill(myDataSet);

DataGrid1.DataSource = myDataSet.Tables[0];

DataGrid1.DataBind();

myConnection.Close();

}

catch(Exception exp)

{

Label2.Text = "<br>Error: " + exp.Message + "<br>";

}

}Hi,

You may take a look at another section of the Web Matrix tutorial,
which is primarily focus on data access with SQL/MSDE Server:
http://asp.net/webmatrix/tour/section2/newconn.aspx

Colt|||hi again. thanks for the site, but my problem is the database is not storred locally. it's on the server. How should i change the syntax in the following code to suit MS Sql Server2000? Your help will be very much appreciated. Thank you.

string connectionString = @."Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\TempProjects\LibraryDatabase.mdb";
public void LoadRequestedBooks(){

try
{

string mySelectQuery = string.Format("SELECT books.* from books, requests where books.bid = requests.bid and requests.mid = {0}", Session["userid"]);
System.Data.OleDb.OleDbConnection myConnection = new System.Data.OleDb.OleDbConnection(connectionString);
System.Data.DataSet myDataSet = new System.Data.DataSet();
System.Data.OleDb.OleDbDataAdapter myOleDbDataAdapter = new System.Data.OleDb.OleDbDataAdapter(mySelectQuery, myConnection);

myOleDbDataAdapter.Fill(myDataSet);
DataGrid1.DataSource = myDataSet.Tables[0];
DataGrid1.DataBind();
myConnection.Close();

}
catch(Exception exp)
{
Label2.Text = "<br>Error: " + exp.Message + "<br>";

}

}|||Hi,

I see.. You can connect to a remote DB server by using its IP address,
E.g. "Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;"
FYI:http://www.connectionstrings.com

Colt

MS Sql Server User ID, Password and connection string

Hi;
I am making a software (.Net) which is going to connect a ms sql server but I cant conect yet :(.

1- I dont know what I have to type for user id (name)
2- What is my password, it has been long time that I hvae installed it but I dont need any password with Microsoft SQL Server Management Studio Express which has windows authentication option. My software can work via internet or network. So I need to know my user name and password. I am using oledbconnection. Do I need any password?
3- I visited www.connectionstrings.com already so I have the format of it.

Thanks very much for any help...you need to either use your windows account and use the example from connection strings dot com that uses windows auth or you need to go to SQL Server management studio to create a sql server login and password and you will need to give that account access to the specific database you are accessing.

man do the redskins suck.

Monday, March 26, 2012

MS SQL Server Express connection error from VB.net Program

I am trying to make new connection with SQL Server 2005 Express Database fro
m
my Visual Basic.Net program. I am using connection string as "Dim
connectionString As String = "Data Source=.\SQLEXPRESS;Initial
Catalog=MgmtSystem;User Instance=True".
But it is giving me error as " Failed to generate a user instance of SQL
Server. Only integrated connection can generate a User Instance".
I can connect to this "MgmtSystem" database successfully using Microsoft SQL
Server Management Studio Express though.
What could be the possible reason for this error? How do I get the correct
connection string? and what does integrated connection mean? Your help will
be appreciated.
My application is in Access at the moment, but I am planning to migrate it
to Microsoft SQL Server Express 2005. I am completely new to Microsoft SQL
Server Express 2005 Express version.Fixed it by myself. I changed the connectiuon string to "Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Data\MgmtSystem.mdf;Initial Catalog=MgmtSystem;Persist
Security Info=True;" ..and it worked..
"Sujata P" wrote:

> I am trying to make new connection with SQL Server 2005 Express Database f
rom
> my Visual Basic.Net program. I am using connection string as "Dim
> connectionString As String = "Data Source=.\SQLEXPRESS;Initial
> Catalog=MgmtSystem;User Instance=True".
> But it is giving me error as " Failed to generate a user instance of SQL
> Server. Only integrated connection can generate a User Instance".
> I can connect to this "MgmtSystem" database successfully using Microsoft S
QL
> Server Management Studio Express though.
> What could be the possible reason for this error? How do I get the correct
> connection string? and what does integrated connection mean? Your help wil
l
> be appreciated.
> My application is in Access at the moment, but I am planning to migrate i
t
> to Microsoft SQL Server Express 2005. I am completely new to Microsoft SQL
> Server Express 2005 Express version.|||Fixed it by myself. I changed the connectiuon string to "Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Data\MgmtSystem.mdf;Initial Catalog=MgmtSystem;Persist
Security Info=True;" ..and it worked..
"Sujata P" wrote:

> I am trying to make new connection with SQL Server 2005 Express Database f
rom
> my Visual Basic.Net program. I am using connection string as "Dim
> connectionString As String = "Data Source=.\SQLEXPRESS;Initial
> Catalog=MgmtSystem;User Instance=True".
> But it is giving me error as " Failed to generate a user instance of SQL
> Server. Only integrated connection can generate a User Instance".
> I can connect to this "MgmtSystem" database successfully using Microsoft S
QL
> Server Management Studio Express though.
> What could be the possible reason for this error? How do I get the correct
> connection string? and what does integrated connection mean? Your help wil
l
> be appreciated.
> My application is in Access at the moment, but I am planning to migrate i
t
> to Microsoft SQL Server Express 2005. I am completely new to Microsoft SQL
> Server Express 2005 Express version.

Wednesday, March 21, 2012

MS SQL Server 2000, and ASP.NET 2.0 membership controls (login)

when my ASP.NET 2.0 web site working against MS SQL Server 2000,
I Usually have a connection string to the DB, I create a connection, and start working on the data.

While reading about the MemberShip provider of ASP.NET 2.0 (Login control, Forgot password, etc.),
I read that it's possible to save the MDF file of the membership controls, within the APP_DATA folder.

But how can it be ? the MDF file must be at the server folder,
How can I access this MDF file ? with which connection string ?
How does MS SQL Server 2000 syncronize against this MDF file within my APP_DATA folder ?

And by the way, if my hosting company allow me to use 1 db schema of the MS SQL Server 2000 server,
Does this method (saving the MDF file within thr APP_DATA folder) allow me to use multiple schemas ?

Thanks.

Hi,

But how can it be ? the MDF file must be at the server folder

For your first question, the built-in database is a new feature in .NET 2.0 which needs SQLExpress to support. The database is together with your application, you don't need to deploy the database additionally. The MDF file is stored in a folder called APP_DATA. When you application runs, the files in APP_DATA will be shipped as a database with your application automatically.


How can I access this MDF file ? with which connection string ?

If you want to access the database in SQLExpress, you also need connection string to achieve that. By default, the connection string for SQLExpress (built-in database) is located in Machine.Config, the name of the connection string is "LocalSqlServer", and you also can overwrite it and declare it at web.config file, even change the name of the connection string. But what you should note is, don't forget to modify the connection string attribute of the provider so that all the features supported by provider mechanism (i.e. Membership,Profile and etc) can work.

How does MS SQL Server 2000 syncronize against this MDF file within my APP_DATA folder

When you have decided to use SQLExpress to support your provider mechanism application, you don't need to use SQLServer2000. But if you want those provider supported application to work with SQLServer2000. You should use aspnet_regsql tool to transport the ASPNETDB to SQLServer2000 database, and modify the connection string attribute of corresponding provider.

For aspnet_regsql.exe tool, see:http://msdn2.microsoft.com/en-us/library/ms229862(VS.80).aspx

For more information about ASP.NET provider, see:
http://msdn2.microsoft.com/en-us/library/aa478948.aspx

Thanks.

|||

Thanks,

At my development machine :
But I removed SQL Server express from my machine, that means I can't just add the login control, than the MDF file will be created at the APP_DATA,
And everything will be ok ? I must install MS SQL Server express ?

At the hosting server :
There is ms sql server 2000, just copying the MDF data to the AAP_DATA, I guess will not work, right ?
I will need to mograte this MDF file, from my APP_DATA folder, to the real DB, right?

|||

Hi,

But I removed SQL Server express from my machine, that means I can't just add the login control, than the MDF file will be created at the APP_DATA,
And everything will be ok ? I must install MS SQL Server express ?

When you remove your SQLExpress edtion, you still can use such features like membership. (Login controls,CreateUserWizard controls and etc.) But you should export the ASPNETDB in SQLExpress to SQLServer Database before you removing your SQLExpress, and change the membership provider.

There is ms sql server 2000, just copying the MDF data to the AAP_DATA, I guess will not work, right ?

It will not work. To use the database in APP_DATA, you must have SQLExpress installed on your server.

I will need to mograte this MDF file, from my APP_DATA folder, to the real DB, right

Right, you need to export the ASPNETDB.mdf to your SQLServer 2000 database.

Thanks.

|||

Thanks

Monday, March 12, 2012

MS SQL Function return string - what am I doing wrong?

Cannot see where I am going wrong. I always get a value of 0. I know my function works correctly, so it must be the VB.

CREATE FUNCTION [dbo].[getNextProjectID] ()
RETURNS varchar(10) AS
BEGIN
''.....................
DECLARE @.vNextProjectID varchar(10)
RETURN @.vNextProjectID
END

Sub LoadNextProjectNumber()
Dim vProjectID As String
Dim cmd As New SqlClient.SqlCommand()
cmd.Connection = sqlConn
cmd.CommandText = "getNextProjectID"
cmd.Parameters.Add("@.vNextProjectID", vProjectID)
cmd.Parameters("@.vNextProjectID").Direction = ParameterDirection.ReturnValue
cmd.ExecuteScalar()
vProjectID = cmd.Parameters("@.vNextProjectID").Value
txtProjectID.Text = vProjectID
cmd.Dispose()
End Sub
Hi Jagdipa,
Are you sure that your function executes correctly? I can run your example and get back string successfully. Try to run Profiler in MS SQL to see function execution log.|||check ifthis articlehelps|||hello..
try to use :
cmd.CommandType = storedprocedure
and
cmd.ExecuteNonQuery|||Thanks guys.
All I had to do was write the following line (thanks busyweb):
cmd.commandType = storedProcedure
Dont know why I need that line when the sql is a function and not astored procedure. I have had this code work before without that line.But, as long as it works...
Jagdip

Friday, March 9, 2012

MS SQL conn string

My MS SQL Server was working perfectly fine locally when I used the following connection string:

server=(local)\\DB;Integrated Security=True;uid=;pwd=;database=AspNetDb

When I moved my SQL server to another machine within my LAN, it stopped functioning.
server=(192.168.1.3)\\DB;IntegratedSecurity=True;uid=;pwd=;database=AspNetDb

Could someone kindly give me some advice? I appreciate your assistance.look at:

http://www.connectionstrings.com/

Saturday, February 25, 2012

MS SQL 2000 string.replace

Hello
with the following query :
SELECT words FROM T1
i get :
A,B,C
how can i get
A > B > C
something like String.Replace(words , ',' , ' > ')
thank youHi,

you can replace SELECT words by SELECT replace(words,',','>')
your query become:

SELECT replace(words,',','>') words FROM T1

goodluck!|||wonderfull, and so easy :-)

thanks a lot|||hi`, sometime everything become simple if we think it simple :)