Defining Connections As Private Variables

Apr 7, 2006

Is there any harm in defining a SqlConnection as a private class variable for a web page?

Private SqlConnection cn = new SqlConnectection(ConfigurationManager.ConnectionStrings["MyString"].ConectionString);

The connection is only opened in certain event handlers, and is closed right after use. It was always my understanding that creating the connection is not a big deal but opening the connection is.

Is that correct?

View 1 Replies


ADVERTISEMENT

How To Use Variables For Server Connections

Dec 21, 2006

Hello,

Today is day two of using SSIS and having some issues adjusting. In DTS I would simply populate my global variables via an Active X step or pass them in at the job line.

I am having a hard time being able to do either or in SSIS. Really all I want to be able to do is pass in a server name to the Connection of an execute SQL task from a scheduled job line.

Same goes for any variable really ... how do I pass them in, and how do I assign them to specific areas of a task?

Thanks!

View 21 Replies View Related

Parent / Child Package - Connections, Variables Etc.,

Aug 13, 2007

In respect to Parent / Child packages, can some one correct me if I'm wrong.

Even if connection managers are created in Parent package, the same needs to be created in child packages if they need to connect to database. On the other hand I can just create connection strings in variable in parent package(instead of connection managers itself) and use parent package variable configuration to configure the connection string of child package with the variable value.

Sorry If I'm confusing


The same with variables, the parent variable needs to be mapped to a child variable(using parent package variable config) to be used in child package, it cannot be used as it is.

Thanks

View 3 Replies View Related

Defining Key In VB

Mar 24, 2008

Hi,I have a table with uniqueidentifier column as its primary key. If I insert a record into this table by defining the key of this record in VB code (Dim myId As Guid = Guid.NewGuid ... is it??), is it possible that I receive the primary key violation error since the new record has an id which is already exists in the table? Thanks in advance 

View 5 Replies View Related

Defining Alert

Aug 7, 2003

if in response to an alert i have defined a job and this job is scheduled for 10.00 am daily, will this job execute daily or only in response to the alert?
also i have set notifications to my computer in alert as well as in job. buti get notification defined in job and not in alert. why is it so?

View 4 Replies View Related

Defining A Clustered Key

Sep 5, 2006

SQL server 2000: I'm told I need to define a clustered key on an existing table Scores for the rows absID and revID.

what is the syntax for this? I'm looking online but not finding it.

thanks.

Dave

View 2 Replies View Related

Defining Primary Key

Feb 1, 2008

Hello

I have this 3 tables, Customer, Transaction and Book. Since a customer can buy the same book more than one time, I've defined Transaction_Nr as primary key of Transaction and put Customer_Nr and Book_Nr as foreign keys. So the layout is more or less like this :

Customer {Customer_Nr, Customer_Name}
Transaction {Transaction_Nr, Date, Book_Nr, Customer_Nr}
Book {Book_Nr, Book_Name}

So now my question is, would it have been better, to define Transaction_Nr, Book_Nr and Customer_Nr as a combined primary key or to leave Transaction_Nr alone ? What would be the difference ?

Thanks !

View 6 Replies View Related

Defining Relationships

May 9, 2008

How do I define a relationship using SQL Server Management Studio?

I can create a view and drag columns between tables easily enough. Is there a way to do this with tables and not views?
Any help appreciated.

Thx

View 5 Replies View Related

Private Key

Mar 6, 2007

Hi

I am trying to setup service broker by following the article on http://support.microsoft.com/default.aspx/kb/915852

The script ran without error, but when I try to send a message, I get the following in the trace Audit Broker Conversation and the message is not delivered.

The certificate's private key cannot be found

This message could not be delivered because the security context could not be retrieved.

Does anyone know what I did wrong, is it the Certficate in the Master Database or the Target Database

thanks

Paul

View 1 Replies View Related

Defining Complex Query ...

Feb 3, 2008

Hi All,
I have two tables.First is CAT_TABLE_LIST ;FIELD_NAME                   OPPOSITE_NAME    TBL_NAMEHeight (mm)                            COL_1                 TBL_13Cylinder volume (cm³)               COL_5                 TBL_13Torgue (daN.m)                        COL_7                 TBL_13Cylinder weight(kg)                   COL_13               TBL_13Pump Type                              COL_9                 TBL_13Fuel Consumption                    Col_22                 TBL_22Color                                       Col_41                 TBL_09--------------------------------------------------------------------Second is TBL_13  (there are a few tables for each distict value for CAT_TABLE_LIST.TBL_NAME column );STOCK_CODE              COL_1     COL_5    COL_7    COL_13      COL_9FC-25                                12,5        5         15.000     45              DP 75FT-45                                 27          9          40.000    35               DP 101--------------------------------------------------------------------the CAT_TABLE_LIST.TBL_NAME holds relevant table name and  CAT_TABLE_LIST.OPPOSITE_NAME holds columns names of  that relavant table.The issue is, the columns of relevant tables dynamicly created. I mean if i insert new row to CAT_TABLE_LIST like that;INSERT INTO CAT_TABLE_LIST ('Size(USA)','Col_77','TBL_13')the new column will created for TBL_13 ;ALTER TABLE TBL_13 ADD Col_77 VARCHAR(200)And if i delete a row from CAT_TABLE_LIST, in the same transaction the column will droped from relevant table, as followsDELETE CAT_TABLE_LIST WHERE TBL_NAME ='TBL_13' AND OPPOSITE_NAME='Col_77'goALTER TABLE TBL_13 DROP COLUMN Col_77--------
Expected select query result is (for TBL_NAME = 'TBL_13' AND STOCK_CODE ='FC-25' ) .....STOCK_CODE     OPPOSITE_NAME            FIELD_NAME                  VALUEFC-25                        COL_1                     Height (mm)                     12,5FC-25                        COL_5                     Cylinder volume (cm³)          5FC-25                        COL_7                     Torgue (daN.m)                 15.000FC-25                        COL_13                   Cylinder weight(kg)             45FC-25                        COL_9                     Pump Type                        DP 75------------------------------------------------------------------------------How can i get this result ?
Thanks in advance...
 

View 1 Replies View Related

Defining A Select Command

May 17, 2006

I'm trying to populate a DropDownList from my SQL database. I'm using C# 2005 and when I compile my code I get an error. Compiler Error Message: CS0103: The name 'myConnection' does not exist in the current context
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default3 : System.Web.UI.Page
{
private string connectionString = WebConfigurationManager.ConnectionStrings["mewconsultingConnectionString"].ConnectionString;

protected void Page_Load(object sender, EventArgs e)
{
SqlCommand myCommand = new SqlCommand();
myCommand.Connection = myConnection;
myCommand.CommandText = "SELECT * FROM tblPau";
myConnection.Open();
SqlDataReader myReader;
myReader = myCommand.ExecuteReader();
myReader.Read(); // The first row in the result set is now available.
lstPau.Items.Add(myReader["PauSiteName"]);
myReader.Close();
myConnection.Close();
}
}

View 1 Replies View Related

Key Factors For Defining Indexes.

Aug 21, 2004

Hello,

Plz explain me what are the key factors or conditions one should consider while defining indexes on a field.

Regards,
Shailesh

View 1 Replies View Related

Problems Defining An XML DataSource

Sep 27, 2007

Hi there,

I'm trying to follow Lesson 1 for using XML Data in a Report here: http://msdn2.microsoft.com/en-us/library/ms345338.aspx

When I go to my local wsdl I see that the target namespace is:

http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices


I create my datasource to point to my local asmx and tested it by going directly to the URL which worked. I then create a dataset in my report which points to this datasource and has this as the query string:

<Query>
<SoapAction>http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/ListChildren</SoapAction>
</Query>


I've created 2 parameters - Item (/) and Recursive (1).

When I try and execute the query, I get the following error:

An error occured while executing the query.
Error while reading xml response.

Error while reading xml response. (Microsoft.ReportingServices.DataExtensions)

Any help would be appreciated. Thanks.

View 2 Replies View Related

Private Messages

Sep 26, 2005

i'm trying to make private messages like the one in this site, i didnt start programming yet, the problem is in the DB schema, i have 3 tables (Users, Messages, MessageDetails) i think the problem that the UserID is related to the other two Tables, so to know the sender and reciever, when i try to view all messages for specific user and show all users who sent it, it give nothing back, so any help in the DB, thanx 4 help.

View 13 Replies View Related

Defining A Query In A Table Adapter

Nov 26, 2007

Now, I don't know if what I want to do is possible, but here goes.  In the table I want to query, there is an "approval status" column, of type Int32.  There are four approval levels, 1, 2, 3 and 4.  What I want to set up is a query in the table adapter that can return all entries of one or more approval levels.  In "raw" sql, I would do something like: SELECT * FROM facility_table WHERE (approved IN (1,2,3));What I want to do though, is to have the list of approval codes to be a parameter that I can pass to the table adapter query, so the where clause becomes "WHERE (approved IN (@approval))", and I pass a string with the list of approval codes.  But the query designer doesn't want to cooperate with me, as it insists that "@approval" should be an int32.Any suggestions? 

View 1 Replies View Related

Defining AS400 Linked Server

Jul 20, 2005

Can anyone help me understand what it takes to define a Linked Serverconnection to an IBM eSeries (AS400)? Do I need Microsoft's SNA Serveror some other product or can I simply do it with the tools provided withSQL Server 2000?Any guidance would be very appreciated. Thanks.Farid

View 3 Replies View Related

Automatically Defining Primary Keys

Aug 13, 2007

Hi,

I am new to SQL Server platform, i want to define primary keys automatically other than using an identity. For a table called indicator i want it primary keys to be like ind_001, ind_002, ind_003 and so on.

Can anybody help me on how to do this? I am new to this platform so i will appreciate it if suggestions are explained very clearly. Thank you

View 1 Replies View Related

Query Defining Parameter Dropdowns Is Run Twice!

Jan 24, 2007

I built a very simple report which uses a query to define the options in the parameter€™s dropdown. I used that same dataset to define the default for that parameter (meaning that it will just pick the first row from the dataset and use that as the default). When I run the report watching a Profiler trace on the SQL database, it runs that query twice. (Presumably, that€™s once to fill the dropdown list and once to figure out the default.) That seems silly to me since it is the same query that is the same dataset in Reporting Services. Is there any way around this? My parameter bar is rendering twice as slowly as it should be.
 
I've tested against SSRS 2005 SP1 and the CTP of SP2.

View 2 Replies View Related

How To Use Value Of A Variable In Defining Data Type

Dec 14, 2007



HI Experts,

I have same table structures in two database and one master table which contains Table id, Table name,primary key, data type of primary key. i have to comapare
Tables in both tha database and as per result i have to do insert,update or delete.

for that i have written query :


DECLARE @rowcount_mastertable FLOAT
SET @rowcount_mastertable = (select count(*) from master_table)

DECLARE @TABLE_ID float,
@TABLE_NAME varchar (100),
@primary_key varchar (100),
@Primarykey_DATATYPE varchar (50),

DECLARE @COUNTER FLOAT
SET @COUNTER = 1

WHILE (@Counter <= @rowcount_mastertable)

Begin

SET @TABLE_NAME = (SELECT TABLE_NAME FROM MASTER_TABLE TABLE_ID = @COUNTER)
SET @primary_key = (SELECT primary_key FROM MASTER_TABLE WHERE TABLE_ID = @COUNTER)
SET @Primarykey_DATATYPE = (SELECT Primarykey_DATATYPE FROM MASTER_TABL WHERE TABLE_ID = @COUNTER)

--In below line i want to declare a variable and datatype should be same as what we got from master table so that i can use this @MAX_primary_key to fetch --max of primary key from table name where table id is 1
DECLARE @MAX_primary_key @Primarykey_DATATYPE
SELECT @MAX_primary_key = MAX(@primary_key) FROM @TABLE_NAME
WHERE TABLE_ID = @COUNTER


---But by running it i am getting error that "Incorrect syntax near '@Primarykey_DATATYPE'. and "Must declare the variable '@MAX_primary_key'.


Please suggest

Thanks in Advance

View 3 Replies View Related

Private Virtual Dtabase

Mar 22, 2000

One of our clients controls data for about 150 companies. Each company has the same schema and is running SQL Server 7. The maintenence task is horrible. He would like to put all the data in one large database, but needs to control the access, so a user at one company selecting data in a table cannot have access to another company's data in the same table. I thought about using views for each company but that is 150 companies times 100 tables. With Oracle8i you can make virtual private databases. Can this be done in SQL Server 7? Thanks in advance

View 1 Replies View Related

Certificate Private Key Cannot Be Found

Apr 15, 2014

I set up Service broker (2008R2 -> 2012) across different servers and domains using certificates.I set up 2 queues (one for sending, one for receiving).I set up 6 services (3 for send, 3 for receive), all 3 sharing the same queue type. (srv_send_1, srv_send_2, srv_send_3), (srv_receive_1, srv_receive_2, srv_receive_3).I set up a route for each receiving service on the source, and for each sending service on the target.I set up a SB binding to the remote for each sender service type.I granted send rights to the sending services on the source server.

I then tested my first service, and it worked perfectly (still works).My second service however is failing with the error "The certificate's private key cannot be found".I am stumped, as all the setup code was a lot of copy/paste which I have checked, rechecked and even re-coded.Basically, here is what Im doing:

begin dialog @ConversationHandle
FROM Service srv_send_1
TO Service 'srv_receive_1'
ON CONTRACT myContract
WITH ENCRYPTION = OFF, LIFETIME = 60*60*24*7;
SEND ON CONVERSATION @conversationHandle
MESSAGE TYPE [my_msgtype] (@xml);

The above code works 100% with service1, but not with service2.Note that on profiler, the target server doesnt receive any communication. The error shows on the sender profiler.Also, The conversation shows up as CONVERSING in sys.conversation_endpoints and the entry exists in sys.transmission_queue.

View 1 Replies View Related

Can I Access My Private Db Through My Web Server?

Aug 30, 2005

Web server: win2003 server with iis6DB: sql server 2000I have 50+ remote offices running an Access 2002 app which connectsdirectly to sql server at a 3rd party hosting company, in part using anodbc connection on the workstation.We recently moved our database (and our web site) in-house. The newdatabase is inside the firewall but outside the dmz, where it livesalong side the company's most sensitive databases. IT's policy won'tallow us to connect directly from the internet. I'm trying to avoidbuying another copy of sql server for the Access app, which I one dayhope to drop anyway in favor ofThe web server uses port 1433 to talk to the database. I was wonderingif there is a simple way to route requests from the Access app throughthe web server.Thanks,Bob

View 9 Replies View Related

SQL CE Private V. Shared Deployment

Feb 2, 2007

I have a couple of questions on the nature of shared and private deployment of SQL Server CE 2005 on mobile devices:

1. I've read that with a shared install, SQL Server 2005 Compact Edition files are automatically updated and serviced by Microsoft Update. I take it that this only applies to installations on desktop computers -- if you're installing on mobile devices, there IS no automatic update. Right?

2. I've also read that in order to do a shared install of SQL Server 2005 CE, the user must have administrative rights. How does this apply to installs on a mobile device? There is no such thing as an administrative user on a mobile device. However, mobile devices CAN require different levels of privilege to install certain programs -- do you need something like an application signed for privileged execution (via a M2M certificate) in order to do a shared install of SQL Server 2005 CE on a mobile device?

Or is the shared versus private deployment only an issue when deploying to a desktop?

Larry

View 4 Replies View Related

Private Deployment Of SQLCE For C++ App

Apr 20, 2007

MSDN has examples of deploying SQLCE privately for C# and VB.NET, but that doesn't seem to translate to C++. A .NET application just loads the assembly it needs from the local directory, but from what I can tell I need to use the OLE DB driver to use SQL CE in C++. The problem is that the OLE DB driver is a COM object that (presumably) needs to be registered.



Has anyone successfully used SQLCE from C++ without registering any COM objects? I'm thinking the only way to do that would be to call DllGetObject() on the DLL and get the object manually, but I've never done this so I'd hate to waste the time if there's an easier way, or if this won't work.

View 7 Replies View Related

Certificate Private Key Recovery

Feb 5, 2008

We are looking to put column level encryption on a table. Great! Wonderful! Look in books online and see that you must give "control" perm to the Certificate for any user that needs to use the symmetric key.

Now my question. I have backed up the Certificate to file. What I have found playing around with the commands is it is possible to run the following command:

Alter Certificate MyCert
Remove private key

BOL says their is no "Restore Certificate" command and to just use "Create Certificate". I have tried this and I keep getting an error saying the certificate already exist in the database.

What have I missed? How can I restore this certificate without restoring the ENTIRE database? Is there a permission set that can be applied to the Certificate to stop thsi kind of command from being run while still having the symmetric key usable? Any help would be of great use!

Thanks,


*note* this is using the MasterKey->Cert->SymmetricKey

View 6 Replies View Related

ClickOnce Private Installation Issue

May 12, 2007

I'm working on a VB.Net 2005 application that uses SQLCE as a backend database.

Following the instructions on how to do a private installation (http://msdn2.microsoft.com/en-us/library/bb219482.aspx) so that admin rights were not needed, I successfully got it working as a ClickOnce deployment. But today during a demo for a client, they ran into this error while installing the latest version from our publishing URL:

"Unable to install or run the application. Application requires that assembly System.Data.SQLServerCe version 9.0.42 .... must be installed in the Global Assembly Cache."



Basically it's saying the user isn't an admin so they can't install. This is the problem I went to great lengths to try to avoid, and is the reason we are using SQL CE in the first place: admin rights are not required to install our application's database. To our knowledge, SQL CE is the only Microsoft product that fits this scenario.

Now, I haven't changed anything in the publishing of the application to my knowledge, and when I check the project prerequisites, the SQLCE engine still isn't in there (as summarized at the above URL). Again following the instructions at the URL above for private installation, the required assemblies are still part of the project's files.

It must be something I did to cause this, but I have no memory of changing anything in regards to this part of the application. Our deadline is in 4 days and I cannot continue development until I get past this issue.

Where do I look to fix this problem? A little help would be greatly appreciated.

View 1 Replies View Related

Using Private Public Keys In SQL2005

Jul 30, 2007

Here is what I am trying to do. I want to create a private / public key pair (either a certificate or asymmetric key) and be able to give the public key to my business contacts. They would then use the public key to encrypt data to be sent to me and then I could import that data into my SQL 2005 database and use the private key to decrypt it.

It seems to me that this should be a pretty simple process, but it is not. The reason I want to do this is that the data they send to me on a regular basis is sensitive. Currently we use PGP, but then I have to decrypt the data and then import it and then reencrypt it. It would greatly simplify my process if I could just import the data and use it.

So how can I do this. Most of the posts I read say that asymmetric keys are avaiable in SQL2005 but not recommended for use. I don't want my business contacts to be able to decrypt any of my data (if they got access to the database) just encrypt.

Any recommendations???

Thanks!

Jim Youmans
St Louis, Missouri

View 5 Replies View Related

Yet Another Question On Private Install In A Native/C++ OLE DB App

Jan 25, 2008

Folks- By reading all the results I got from doing a search on "private install" in this forum, I thought this must be as easy as:

1. Copying the seven DLL's comprising the engine to my application's install dir on the deployment machine. If my app is installed at C:MyApp then CE dll's would go into C:MyApp, thats where my WinMain'd exe is residing.
2. RegSvr32 on sqlceca35.dll, sqlceoledb35.dll

Since I'm using native C++/OLE DB, I don't think I'd need to care about System.Data.SqlServerCe.dll

However my app which is basically the NorthWnd sample is failing on CoCreateInstance(CLSID_SQLSERVERCE_3_0............)

Which means oledb provider not registered on the machine? am I correct?

I watched Steve Lasker's video, even though the private install covers managed code, but I thought I should be doing something very similar, apparently I'm missing something.

I'll appreciate any help.

P.S., The 7 dll's above I mentioned are:
sqlceca35.dll
sqlcecompact35.dll
sqlceer35EN.dll
sqlceme35.dll
sqlceoledb35.dll
sqlceqp35.dll
sqlcese35.dll

View 3 Replies View Related

Help Needed -- Dynamically Defining Files In Connection Manager

Nov 12, 2007

I am pretty new to SQL Server 2005 and SSIS. I am trying to dynamically load files into SQL Server 2005 using files/paths contained in tables. I have a key table in my SSIS package that defines which files should be processed, some default values that will be associated with each file (ie CompanyKey and PeriodKey) and the file path (see below for example):











CompanyKey

PeriodKey

ProcessFlag

FileName


2

61

FALSE

2005TB200501.xls


2

62

FALSE

2005TB200502.xls


2

63

FALSE

2005TB200503.xls


2

64

TRUE

2005TB200504.xls


2

65

TRUE

2005TB200505.xls


2

66

TRUE

2005TB200506.xls


2

67

TRUE

2005TB200507.xls


2

68

TRUE

2005TB200508.xls


2

69

TRUE

2005TB200509.xls


2

70

TRUE

2005TB200510.xls


2

71

TRUE

2005TB200511.xls


2

72

TRUE

2005TB200512.xls

The package I am developing is supposed to loop through this table checking for files with ProcessFlag = TRUE. For those files, it will load all of the records/columns (prefaced with the company and period keys) into a common table.

Do I have to manually create data sources for each file or is there a way to dynamically define the connection and process the connection?

Any assitance you could provide would be greatly appreciated!

Thanks.
Vik

View 3 Replies View Related

Defining Custom Roles With Limited Access To SQL Objects

Jan 29, 2007

Hi!

I'm assisting in the creation of a development enviroment with SQL Server 2005, and I need to assign some custom roles, in particular, a Stored Developer Role should be able to create, modify and execute Stored Procedures but they should not be able to alter tables or views, but should be able to retrieve/insert data from those tables.

I've tried with the default roles in 2005 to no avail.

Is there a relatively easy way to accomplish this with a database alredy populated with objects of both kinds? (SP's and Tables / Views)

Thanks!

View 1 Replies View Related

Defining An Event Inside Of An Assembly =&&> UNSAFE (no Workarounds?)

Oct 20, 2006

Can someone verify that an assembly containing an interface with an event definition, such as...

public interface A {
event EventHandler Foo;
}

... can never be loaded under SAFE or EXTERNAL_ACCESS ?


It appears that the compiler-generated add_xxx and remove_xxx have the MethodImpl(MethodImplOptions.Synchronized) attribute defined by default, and "Explicit synchronization is not allowed". The same limitation also applies to classes by default, although technically one is able to define the implementation directly (clearly not ideal).

View 1 Replies View Related

Schema Advice For Private Message Function

Jul 16, 2007

 Hi Guys, I've got a bit stuck trying to decide on a table structure for a private message like part of a site I'm building (I'm using SqlServer 2000, not that it really matters).at first I was going to use a single table with the following schema: MessageId intReplyToMessageId int (nullable)FromUserId uniqueidentifier (I'm using .net membership)ToUserId uniqueidentifier IsRead bitIsDeleted bitSubject nchar(50)Body nvarchar(1000) DateCreated datetimeDateUpdated datetimeCreatedBy uniqueidentifierModifiedBy uniqueidentifier What strikes me here is that I'm using alot of guids (which are huge) and if I'm going to be threading the messages (which I am) there's no easy way to return an ordered list of messages that are replies to each other. So then I thought about introducting a messageThreads table, but I can't think of anything to store there apart from a threadid (which seems to defeat the purpose)Any ideas? I can clarify more if necessary. Thanks  

View 6 Replies View Related

How To Forcing The Mirror Communication To A Private Network?

Jun 16, 2007

SQL 2005 Standard x64 Service Pack 2

Windows 2003 R2 X64 service pack 2



The principle, partner and witnesss have two NICs each (NIC1 and NIC2). I want them to communicate in NIC2 for sending logs and establishing quorum. This will happen in their own private network (say 192.168.1.0/24). The NIC1 in each server will be available for client communication. The domain and clients are in the network (say 10.1.1.0/24).



I am using the same domain account as SQL server service account in all three servers.



How can I do this?



Thanks

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved