Connect To .DataSource=.... Using Authetication (userid && Passphrase)!
Nov 9, 2006
Hi,
My school is runnnig SQL Server 2005 and i want to connect to it using authetication (userid & passphrase). As i coded the windows application i used localhost as my own computer and IntegratedSecurity shown below. I'm new in C# and SQL. I would appriciate if someone could help me out.
using System;
using System.Data;
using System.Data.SqlClient;
using System.Text;
namespace Personregister
{
class DBManager
{
SqlConnection conn;
SqlConnectionStringBuilder builder;
public DBManager()
{
builder = new SqlConnectionStringBuilder();
builder.DataSource="localhost";
builder.InitialCatalog = "Personregister";
builder.IntegratedSecurity = true;
conn = new SqlConnection(builder.ToString());
}
// more code fallows ......
}
}
Best Regards,
View 1 Replies
ADVERTISEMENT
Mar 7, 2008
I've tried everything. The CreateUserWizard works fine, but then, I didn't have to connect anything for that. I've tried both SQLServer and MySQL. Connection Strings are correct, everything is correct as far as I can see. I've followed every step many many times. I'm about to go back to the old style and use VB6, because this is just stupid. The error I get is "An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)" If anyone could help me out with this I'd really appreciate it.
View 6 Replies
View Related
Apr 11, 2006
Hi I am trying to open a database connection to a Northwind database. I can open it with a datasource control and return data to a gridview, but can't programically. I get a sqlexception error. this is ust for learning.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim S As New SqlConnection Dim builder As New SqlConnectionStringBuilder builder("Data Source") = ".SQLEXPRESS;AttachDbFilename=C:SQLNORTHWND.MDF" builder("Integrated Security") = True builder("Connect Timeout") = 30 builder("User Instance") = True S.ConnectionString = builder.ConnectionString Me.Label1.Text = S.ConnectionString S.Open() Me.Label2.Text = S.State.ToString S.Close() Me.Label3.Text = Me.SqlDataSource1.ConnectionString.ToString End Sub
The text in label2 and Label three are identical except there are "" around the datasource.
How come I can connect through the datasource control but not through code?
View 6 Replies
View Related
Aug 21, 2006
I've never used SQL Server before. I installed VB 2005 Express (I've been working with VB since I was 16), and SQL Server 2005 Express.
I installed the server with all the default settings and created a small database to handle customer information (a remake of some Access and Oracle databases I've made before).
I'm told, however, each time I try to connect to the database via VB, that SQL Server isn't accepting remote connections...
Remote? It's on a local computer. So is VB...what is going on here? Is there a setting I've missed?
Warren Ayen
IBM
View 12 Replies
View Related
Nov 18, 2006
created an Oracle datasource (tried both ole db & oracle client) in Visual Studio 2005 report project - works fine connecting and preview of report within ide , deployed to Reporting Services web server, received the following error when attempting to run the report on web server:
An error has occurred during report processing. (rsProcessingAborted)
Cannot create a connection to data source 'oracle'. (rsErrorOpeningConnection)
System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.
web server has oracle client 9i client installed and connecting to db ok through sql plus (this server also is loaded with VS2005 and the SqlServer2005 db)
any thoughts or direction greatly appreciated
View 4 Replies
View Related
May 16, 2006
I am investigating methods of encrypting data in a large number of databases. It seems to me that encrypting by passphrase would be optimum because it would prevent me from having to create all those database and symmetric keys on the various databases (there wil lbe dozens of them). Can anyone give me any advice as whether or not using encryption by passphrase is a good secure method of encrypting sensitive data in a large-scale production environment? I would most likely create a unique passphrase for each database and pass it to a stored procedure as an imput parameter.
Thanks,
Al
View 19 Replies
View Related
Dec 10, 2014
I decided to delete the encryption key.After that when I go to the reporting page, the report cannot connect to the datasource.
An error has occurred during report processing. (rsProcessingAborted)
Cannot create a connection to data source 'xxxxx'. (rsErrorOpeningConnection)
For more information about this error navigate to the report server on the local server machine, or enable remote errors
What do I suppose to do?
View 0 Replies
View Related
Mar 13, 2008
I have two tables - gift_cards and history - each related by a field called "card_number". This field is encrypted in the history table but not in the gift_cards table. Let's say the passphrase is 'mypassphrase'. The following query takes about 1 second to execute with a fairly large amount of data in both tables:
SELECT max([history].[date_of_wash]) AS LastUse
FROM gift_cards AS gc LEFT JOIN history
ON gc.card_number=CAST(DecryptByPassPhrase('mypassphrase', HISTORY.CARD_NUMBER) AS VARCHAR(50))
GROUP BY gc.card_number
When I use a declared variable to contain the passphrase, the same query takes over 40 seconds. For example,
declare @vchPassphrase as nvarchar(20)
select @vchPassphrase = 'mypassphrase'
SELECT max([history].[date_of_wash]) AS LastUse
FROM gift_cards AS gc LEFT JOIN history
ON gc.card_number=CAST(DecryptByPassPhrase(@vchPassphrase, HISTORY.CARD_NUMBER) AS VARCHAR(50))
GROUP BY gc.card_number
This query is part of a stored procedure and, for security reasons, I can't embed the passphrase in it. Can anyone explain the discrepancy between execution times and suggest a way to make the second query execute faster?
Thanks,
SJonesy
View 4 Replies
View Related
Jul 8, 2007
Hi all,
This is my first post and I am a newbie user of SQL Server as well. I am using SQL Server 2005 Express edition. I have also installed SQL Server 2005 Mangement Studio express.
Initially I was under Windows Authetication but today I changed it to mix mode. After doing everything and enabling the authentication for the "sa" user I am getting the following error.
In the login dialog window for the user name I am providing: sa
TITLE: Connect to Server
------------------------------
Cannot connect to WC-D9A44337398FSQLEXPRESS.
------------------------------
ADDITIONAL INFORMATION:
A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (Microsoft SQL Server, Error: 233)
When I try the second time it gives this error:
TITLE: Connect to Server
------------------------------
Cannot connect to WC-D9A44337398FSQLEXPRESS.
------------------------------
ADDITIONAL INFORMATION:
Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)
However I am still able to login through the Mangement Studio through the Windows Authentication.
Any help is greatly appreciated
View 1 Replies
View Related
May 7, 2008
In my site, when a user registers, I need to create rows in additional tables besides aspnet_Users. So, I need to be able to pass the generated userId guid to subsequent SqlCommands. I'm having a terrible time with this. What's the correct way to set up a SqlParameter so that it will accept a guid? I keep getting this error: "Conversion failed when converting from a character string to uniqueidentifier."
I've tried creating the parameter both with and without a SqlDbType.
cmd.Parameters.AddWithValue(paramName, guid);
and
SqlParameter p = new SqlParameter(paramName);p.SqlDbType = SqlDbType.Guid;cmd.Parameters.Add(p);
and I get the same error either way.
Driving me nuts! Any help appreciated.
View 1 Replies
View Related
Sep 25, 2004
Hi, I'm having a rough weekend and really need some advice. We've been having some problems with our SQL Server ever since an upgrade to SQL 2K and then were moved by the IT security people to a new domain that is not in a trust relationship with the domain the SQL Server is on. After the move, attempts to log into a CMMS application we use, called Maximo, are failing. The error indicated that the user's domain login isn't trusted with the SQL Server. This is odd, because we use SQL Server Authentication and each user has a different username on the SQL Server and shouldn't care about the domain login, so I don't know why it's even being passed. This application has been working fine on SQL Server 7 for the past 3 years.
Our SQL Server is setup for Mixed Mode (set during installation and verified in Ent Mgr) and the clients are using ODBC to connect with TCP/IP port 1433 (setup with the client configuration in the ODBC properties) using SQL Server Authentication. The problem is that the settings seem to be ignored and it's using Windows Authentication only, which is a major problem. All of the grants are given to the SQL Server user by the Maximo application and all records are tracked by the login, so we can't use Windows Authentication. I am able to add the user's domain login to SQL Server and give it RW rights to the database and the user is able to login, however unable to run reports because the grants are given to the SQL Server login, not the domain login.
I tried removing the server from the domain it was on and making it a stand alone server, which resulted in the following error:
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
This is telling me that it's ignoring SQL Server Authentication. I've also tried installing Patch 3a on SQL Server and installing MDAC 2.8 on the client.
Please help, I need to get it running by Monday.
Thanks
View 4 Replies
View Related
Mar 28, 2006
I choose SQL and windows authetication during SQL Express 2005 install. Will this has any impact on the connection string in my Visual Studio 2005 environment?
View 3 Replies
View Related
Nov 22, 2006
Hi there everyone, this is my first post so go easy on me :)
Basically I am trying to get my database to copy the value in the UserId (unique identifier field) from the aspnet_Users table to a foreign key UserId in a table called userclassset. I have made this field the same datatype and created a relationship between the two. Unfortunately, when I add a user using the ASP.Net configuration tool it does not automatically copy this value into my own custom table. I have noticed it is however automatically copied into the aspnet_Membership table. Any pointers on how to solve this would be great!
Thanks :)
View 2 Replies
View Related
Feb 15, 2008
Hello everyone.
i need to auto generate the user id in id colunm in my sqldatabase table.i want it to generate in this fashion.(mycompanyname-todaydate-number.)eg (ibm-15thfeb-1) (ibm-15thfeb-2) (ibm-16thfeb-1)here i need this user id to be automatically displayed in my web form when doing registration of new user,then only after clicking the savebutton i want all the data along with user id to be inserted into the table in sqldatabase.thanksjack.
View 38 Replies
View Related
Mar 5, 2008
HiI've my ConnectionString in web.config... I want to display the DB UserID on my webPage and UserID is specified in ConnectionString... Can any one help me in this caseThanksNasir Ibrahim
View 2 Replies
View Related
May 13, 2008
I am trying to configure a sqldatasource control using the where clause to grab a single record with a certain UserId. Teh UserId is stored in a variable of type System.Gui and I cant seem to figure out how to do this. Can someone give me a hand please?
View 3 Replies
View Related
May 24, 2006
I'm trying to sort by domain user id, I can pull the user id fine but now I want to sort my SELECT by that name. How do I put the value of getUserIdentity into my SELECT statment.
Thanks
<script language="C#" runat="server"> protected string getUserIdentity() { return HttpContext.Current.User.Identity.Name.ToString().Replace("DOMAIN\", ""); }
protected void Page_Load(Object sender, EventArgs e) { username = getUserIdentity(); SqlConnection myConnection = new SqlConnection("Data Source=CLIENTELE;Initial Catalog=forms;Integrated Security=True"); SqlDataAdapter myCommand = new SqlDataAdapter("SELECT * FROM formTable WHERE userID = @username ORDER BY status DESC", myConnection);
DataSet ds = new DataSet(); myCommand.Fill(ds, "names");
MyDataGrid.DataSource=ds.Tables["names"].DefaultView; MyDataGrid.DataBind(); }
</script>
View 1 Replies
View Related
Jan 6, 2005
Hello
Currently, I am using a varchar "UserName" as a primary key instead of an Identity or GUID.
System Info:
When user's sign up they provide the "UserName" that is used as a PK.
Creating a message board type web application.
UserNames will never change.
UserNames are used extensively as FK's in other Tables.
We want to scale well.
Does anyone know the implications?
I understand Joins are faster on numerical values than strings but we will not be performing many joins.
In my case is it better to use Identity as a PK or is it better to use a varchar for a "Users" table?
Thanks
jenn
View 1 Replies
View Related
Mar 29, 2007
I wrote trigger to insert old data before update or delete .
Now while inserting i want to insert userid and machine id
for user id ia tried the following query as
SELECT CURRENT_USER;
it retuns o/p as dbo
Please give me solution
Malathi Rao
View 3 Replies
View Related
Feb 28, 2008
I have installed Sql Server 2000 Reporting Services.
I desinged report in VS 2003.When press F5 key.Every time it is asking for user id password then only it is giving List of Report Names.
Is there any way to avoid giving user id and pwd every time.
Regards.
View 1 Replies
View Related
Jun 11, 2007
I am creating a new application and just created a new database
Application: VB.net 2005/ ASP.net
Database: Sql Server 2005 with four tables
I need to set the userid and password on the database. How do I do that?
I want to be able to create a SQL connection object in my code and I have something like the following:
<CODE>
Dim objcon As New SqlConnection("server=serverName;uid=;pwd=;database=SomeDatabase")
</CODE>
but the "uid" and the "pwd" are not set on my database. what is an easy way to do this? thanks
View 4 Replies
View Related
Feb 24, 2008
Well, I want to store my customer records in two tables in an SQL Server 2005 Database. (Visual Studio 2005 with ASP.Net and C#).
I want to create a unique ID for each user which starts with either an IN or a CO (indivudual or Company). This information is stored in two seperate tables, one table called individual and one table called company.
I want my individual table to store a unique ID with IN************, so it should have IN followed by a 12 digit unique ID.
I want my company table to store a unique ID with CO************, so it should have CO followed by a 12 digit unique ID.
I'm afraid Unique IDs are something im not very familiar with, so any help would be greatfully appreciated, but please be clear as I have a bit of trouble understanding. I wouldn't know how to even begin this, as I have trouble using simply the UniqueIdentifier attribute.
Thank you in advance for any help!
View 2 Replies
View Related
Nov 25, 2005
Hello!I work with oracle, mySQL but im completely new to SQLserver.How can i set a auto-increment unique variable for userID ?After deleted user, the userID should be never used again on a new user.Thank you,
View 1 Replies
View Related
Jan 24, 2006
I have a user which has the currect rights to do what he needs but others with the same permissions (from what I can tell) can not do somethings. It looks like I have 2 options
a.) find a way to mirror the working one to 30 others ids
or
b.) find some tool that will do a detailed comparision of the two ids
Any suggestions/tools(free)/scripts that would work?
Thanks
View 1 Replies
View Related
Apr 8, 2008
Hi,
I have the following situation:
I have a table that is log of transactions of useractions. Each time a userstatus changes, a new entry is made into the table.
The table has (currently) about 4 million records, and keeps growing each day with thousands of records. It logs the status of about 150 users (currently active).
What I now want is to get the log-entry from all the distinct users that have a log-entry on the latest day (so current day, 'where TimeStamp > 2008-04-08').
(extremely simplified) Example:
(date is y/m/d)
USERID TIMESTAMP STATUS
----------------------------------------------------
... (thousands and millions of records above)
Ed 2008-04-07 18:00:00 Logged_Out
Jim 2008-04-07 18:30:00 Blabla_Status_5
Jack 2008-04-07 19:00:00 Logged_Out
Jim 2008-04-07 19:30:00 Logged_Out
Jim 2008-04-08 06:00:00 Logged_In (<< notice new day)
Jim 2008-04-08 06:01:00 Blabla-Status_1
Bob 2008-04-08 06:03:00 Logged_In
Fred 2008-04-08 06:05:00 Logged_In
Jim 2008-04-08 06:08:00 Blabla-Status_2
Jack 2008-04-08 06:12:00 Logged_In
Fred 2008-04-08 06:20:00 Blabla_Status_5
Jack 2008-04-08 06:12:00 Logged_Out
Fred 2008-04-08 06:12:00 Blabla_Status_4
Jack 2008-04-08 06:12:00 Logged_In
Jack 2008-04-08 06:12:00 Blabla_Status_7
----------------------------------------------------
The result should be:
USERID TIMESTAMP STATUS
----------------------------------------------------
Jack 2008-04-08 06:12:00 Blabla_Status_7
Fred 2008-04-08 06:12:00 Blabla_Status_4
Jim 2008-04-08 06:08:00 Blabla-Status_2
Bob 2008-04-08 06:03:00 Logged_In
----------------------------------------------------
(How) can this be done in one stored procedure?
View 7 Replies
View Related
Oct 17, 2007
I am writing a VBscript which takes my machine details and put in the SQL database.
But after executing the script , i got the following error: Microsoft OLE DB Provider for SQL Server: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
I dont remember the password I have given during installation.
Please tell me how to get the password of sql server.
View 2 Replies
View Related
Apr 29, 2008
our application user is a db owner and my auditor has asked me to change the permission.
what permission should be give for the application user who can access all the schema. create temprorary table and drop
tables.
View 3 Replies
View Related
Jan 7, 2008
I use DTSRun /Uuserid /Ppassword /Sservername .... in a batch process.
I always get the error message to run with a trusted connection. I can run the same batch process from a command line under my own domain id and it runs as if it had a trusted connection.
Will DTSRun run only with a trusted connection? Do I need to set something in the package to get SQL Server to run with a userid and password? Why does it always default to using a trusted connection. I need to know what I have to set to tell it that I am using a userid and password. I have included an example of how it's coded in the BAT file.
Example:
DTSRun /S"myserver" /Umyuser /Pmypass /N"Load_Data" /L "c:mylogsLoad_Data.log" /W"0"
View 4 Replies
View Related
Jul 14, 2007
When I tried to browse the reportserver url. The IE 7.0 asks me for Username and password. I feel, its some settings related to security. But other sites created are working fine. The virtual directories created using Repoting services configuration manager only ask me username and password.
Any suggestions.
Murali.
View 3 Replies
View Related
Mar 27, 2008
I have recently had a few reports that are built around the userid parameter start failing to pass the userid parameter. If I run the report and hard code the userid everything runs just fine, but I am not able to collect the userid when the user is logging into the report server. Any thoughts or suggestions?
R/ AA
View 3 Replies
View Related
Nov 8, 2006
I
want to join my existing tables such as ORDERS with aspnet_Users.UserId on ORDERS.CustomerId.But I am confused which data type should I choose for customerId field.The
datatype of the of aspnet_Users.UserId is uniqueidentifier, but
obviously I cannot assign my customerId field to uniqueidentifier data
type. I found that "The uniqueidentifier data type in SQL Server is
stored natively as a 16-byte binary value." I wish aspnet_Users.UserId
would be an integer IDENTITY field. I also want to ask if I can change
UserId field's datatype to integer?There are also some other tables that I want to join with aspnet_Users table on its UserId field. Can you suggest any solutions?
View 5 Replies
View Related
Feb 3, 2008
Hello everyone,i have a web form to take user details.as soon as the submit button is clicked the form is submitting and the new row is being added into the sqldatabase.its fine ..but in the newly added row, i want the user id(primary key and auto generating) to display in different manner.in mytable column(userid),instead of userid auto displaying 1,2,3,4 ...i want it to display in this way.these are all primary keys of rows added.todaydate-username-1 eg(2.2.2008-jack-1)todaydate-usernaem-2 eg(2.2.2008-zak-2)todaydate-usernaem-3 eg(2.3.2008-leme-2)any idea how to achieve this.?thanks.jack.
View 9 Replies
View Related
Jun 6, 2014
I have the following query:
Code:
SELECT DISTINCT [WL].[Id]
,[WL].[UserId]
,[WL].[DIF]
,[WL].[MW]
,[WL].[Notes]
,[WL].[WDate]
[Code] ....
And the error i get is:
> Column 'Wsite.dbo.WLog.Id' is invalid in the select
> list because it is not contained in either an aggregate function or
> the GROUP BY clause.
What I am wanting to do is just conbine the data if there are more than one **UserID** in the list.
As an example:
Code:
Id | UserId | .... | Id | UserName | SLength | ....
5843| 99304 | .... | 99304| Bob Barker | 14 | ....
5844| 06300 | .... | 06300| Dean Martin | 104 | ....
5845| 99304 | .... | 99304| Bob Barker | 8 | ....
5846| 99304 | .... | 99304| Bob Barker | 11 | ....
5847| 7699 | .... | 7699 | John Doe | 0 | ....
So it should look like this:
Code:
Id | UserId | .... | Id | UserName | SLength | ....
5843| 99304 | .... | 99304| Bob Barker | 33 | ....
5844| 06300 | .... | 06300| Dean Martin | 104 | ....
5847| 7699 | .... | 7699 | John Doe | 0 | ....
Notice that Bob Barker's SLength was combined (14+8+11=33).
View 1 Replies
View Related