|
OK so I'm going to attempt to answer what I can, and I would welcome any rebuttals from anyone with conflicting information. I am pretty much a newbie, and all I can offer are suggestions to get you started. So forgive me if I get too basic.
It looks like your first job is to figure out what security you need to connect to your SQL Server remotely, forgetting your code. Just figuring out what credentials you need, and in what context, will help you figure out what to put in your code.
First of all, "Integrated Security" is to say "Windows Authentication", or, taking the credentials of whomever is logged in, and passing those credentials automatically. So if I'm logged in locally to MYCOMPUTER, my credentials being passed would be UserName: MYCOMPUTER\SueH Password:SuesPassword. If I'm logged into the domain MyDomain, my credentials being passed would be MyDomain\SueH Password:SuesPassword.
SQL Server Authentication is the other choice, which is to say, give me a User Name and Password. You have to set up this name and password in SQL Server, through Enterprise Manager.
To get to Enterprise Manager, select All Programs -> Microsoft SQL Server -> Enterprise Manager. This should be installed on the machine where your database resides.
When you bring up Enterprise Manager, you will want to expand the database in question. Drill through until you see the folder for Security, and check out Logins. That's where you want to put your security. If you just want to pass in a name and password through SQL Server auth, just type in Name for the username; however if you want a domain account to have access, don't forget to type in the username as Domain\User such as MyDomain\SueH.
Next, if you want to enable your SQL Server to accept SQL Server authentication and not just integrated security, right-click on the database in question, and select Properties. Go to the Security tab, and choose "SQL Server and Windows" instead of "Windows Only". CAUTION: If you are not the database administrator, I would highly recommend you consult with them. Screwing around with security can leave holes all over the place if you're not careful.
For each login you want to give access to, you can right-click on the login and select Properties, and it will allow you to "lock down" each login to the level of security you want the application to use. With a little investigation, you can lock down an account to only the databases, tables, views, and sprocs you want, and even read-only I think.
Once you are a little more familiar with the login process, you can look at how best to integrate your code with it. Try logging in from Query Analyzer (another tool in the SQL Server folder) using different methods, and see which accounts have which types of access.
Good luck, hope any of this helps.
Sue
|
|
|
|
|
Not only do I not have a "Microsoft SQL Server" folder anywhere in my programs, when I drill through "C:\Program Files\Microsoft SQL Server" I can't find the enterprise manager there either. All I can find that is any use at all is sqlmangr.exe which is just the SQL Server Service Manager (it only has drop down boxes for server and service and a play, pause and stop button).
Is there any possibility that I don't have MS SQL Enterprise Manager installed? If you can let me know what the .exe file is, I can search for it.
Thanks.
The ends can never justify the means. It is the means that determine the ends.
|
|
|
|
|
Well, do you have a C:\Program Files\Microsoft SQL Server\80\Tools\Binn folder? If you do, look for isqlw.exe (Query Analyzer) and SQL Server Enterprise Manager.MSC (Enterprise Manager). Ent Mgr is a "Snap-in" to the MMC Console (like if you go to "Computer Management" from the Administrative Tools menu).
If not, you may have the free version of only the engine. Could you do this - go locally where you know it works and "ask" for the version: look at this web page http://www.ssw.com.au/SSW/KB/KB.aspx?KBID=Q746022[^] or this page http://www.sqlteam.com/item.asp?ItemID=8318[^]. You simply have to send SELECT @@VERSION and it will return you the version, then you can match up the results.
In any case, if you're using Visual Studio 2003 (or 2002 I think) you can go up to the View menu and choose "Server Explorer". Choose the local server (where the database is) and expand the server until you see SQL Servers. Expand that and you should find your database. To my knowledge, you cannot change any logins from here, but at least you can look at the data. You can add tables, stored procedures, and views, and the Visual Studio IDE will "help" you create the sql for it by giving you a template.
Anyway, depending on what version you have, that will determine how you set up your logins. I'm really getting into territory here I don't know well, but see what you can find out and we'll go from there. My boss wrote the book on SQL server - quite literally, wrote a book - so if I don't know I can find out.
|
|
|
|
|
Thanks so much for your help Susan.
I do ahve the folder C:\Program Files\Microsoft SQL Server\80\Tools\Bin, but I don't have either isqlw.exe or SQL Server Enterprise Manager.MSC. I remember doing something with the MMC Console before, but I'm not sure how to get there now (no problem getting to "Computer Management" - it's faster to just right-click on "My Computer" and select "Manage", by the way).
I also don't know what you mean by going locally to where I know it works and then asking for the version. The only way that I've gotten it to work at all is by writing code in my application that opens up a connection and sends the SQL commands at run-time. I tried modifying to send the SQL Command "SELECT @@VERSION" but it's not working (neither executescalar() nor executenonquery() worked).
On the bright side, I was able to use the Visual Studio 2003 Server Explorer to find my database - just not sure what to do with it once I find it.
So... any other ideas on how to find out the version AND/OR download the query analyzer and enterprise manager?
Thanks again for your help so far!
The ends can never justify the means. It is the means that determine the ends.
|
|
|
|
|
This web site http://www.aspfaq.com/show.asp?id=2160[^] seems to indicate that if you have the free version of SQL Server engine, MSDE (I think that's something like Microsoft SQL Desktop Engine) you should have the osql command line tool. That's like query analyzer without the graphical interface.
If that's the case (it would be in the same BINN folder I wrote about last post) then you can set up your logins using osql/SQL commands if you have to.
|
|
|
|
|
OK, OSQL.exe works, but I can't log in to ther server. Since it's Integrated Security I would have thought I dont' need username/password, but the command prompt wants me to enter them.
Ideas?
The ends can never justify the means. It is the means that determine the ends.
|
|
|
|
|
Of course, if you don't log in with a network account, there is always the question to investigate: can you get to ANY file on the server in question, from your laptop? I'm not sure how your setup is - well - set up, such that you are accessing things remotely.
|
|
|
|
|
You may be a newbie, but you definately know a whole lot more than I do. Thanks so much for your help. I'm going to try out all the things that you've mentioned so far.
I can get to the server from my laptop, but it asks me for a login to get on. I have to supply domain name\user name and password before I get access.
Also, just so you know, the database one I've assembled from scratch and is located on my personal workstation, so I don't have to talk to an admin. Besides... I work in a small company. Our "network admin" is also our accountant.
I'll let you know how it goes!
The ends can never justify the means. It is the means that determine the ends.
|
|
|
|
|
Well, I'm glad I have been able to be of some slight assistance so far. I was happy to see in the other thread (MSDE 2000) some of the same information we've been talking about.
So what it looks like you may have to do at this point is try to log in using an administrator password. The default administrator user name is "sa" and the default password is usually blank, "sa", or "password". I hope you changed that during installation, but if you didn't, then you can try one of those suggestions. Once you log in as an administrator, you may want to set up some logins right away, such as the ComputerName\Administrators group with full privileges.
I really feel bad for you that you are working with MSDE as your first experience working with SQL Server, because although the engine is great and powerful, there is no graphical help and you have to do everything using SQL Commands. Larger ramp-up time than normal. The good news is there's very comprehensive documentation called SQL Server Books On-Line at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_tsqlcon_6lyk.asp?frame=true[^] which gives you syntax for all the SQL Queries you could ever wish to do.
Let's take a SQL Server Authentication example:
Add the login 'SusanH' to the SQL Server instance
EXEC sp_addlogin 'SusanH', 'SusanHsPassword'
Give 'SusanH' some permissions
GRANT CREATE DATABASE, CREATE TABLE<br />
TO SusanH
Now let's look at a Windows Authentication example:
Grant permissions to an existing domain account
EXEC sp_grantlogin 'MyDomain\SusanH' -or-
EXEC sp_grantlogin 'MyComputerName\SusanH'
I'm not completely sure if these are proper samples that will work, however I think you get the idea and can take it from here by looking through the transact-sql reference documentation. They give the syntax for the statements at the top, examples at the bottom, and links to 'see also' topics.
Good luck.
|
|
|
|
|
Hi,
i have file - bitmap how using C# i can get each layer for all four color CMYK?
Greetings
|
|
|
|
|
Layers?
If you want to convert RGB to CMYK then try to search the rather old site:
www.google.com and you'll find it in a sec, try the words rgb cmyk conversion algorithm formula or something alike.
Niklas Ulvinge aka IDK
|
|
|
|
|
BTW, the correct formula should be:
C = 1.0 - R
M = 1.0 - G
Y = 1.0 - B
K = min(C, M, Y)
CORRECTION: R, G, B values must converted to 'float'.
For example 255 = 1.0, 127 ~ 0.5
Use this: FloatValue = R(or G or B) / 255.
[ITA] Tozzi ha ragione: Gaia si sta liberando di noi.
[ENG] Tozzi is right: Gaia is obliterating us.
-- modified at 15:29 Wednesday 31st August, 2005
|
|
|
|
|
Are you sure?
I've seen some other more complex formulas...
Niklas Ulvinge aka IDK
|
|
|
|
|
I'm pretty sure.
However you can try.
[ITA] Tozzi ha ragione: Gaia si sta liberando di noi.
[ENG] Tozzi is right: Gaia is obliterating us.
|
|
|
|
|
I think the different formulas perform better and worse, the quality of the colors is redused with the conversion and the complex one's isn't losing as much quality as the others, I think.
Niklas Ulvinge aka IDK
|
|
|
|
|
Yes, I believe it too. After a google search, I have noticed that each software house uses different formuals. The ones I've posted are used by Adobe for the PDF format.
Try to download the PDF specifications (1300 pages or so!!!) from the Adobe site. Unfortunately I don't remember the exact link.
[ITA] Tozzi ha ragione: Gaia si sta liberando di noi.
[ENG] Tozzi is right: Gaia is obliterating us.
|
|
|
|
|
Hello
Yes, Niklas is right. There is no any conversion classes from RGB to CMYK in .NET. So, the only way is to get conversion formulas from google and use them by yourself.
With best regards,
Andrew
|
|
|
|
|
I am using Data Application Block of June 2005 version of enterprise library. I am able to use the executeNonQuery method which is given in the quick starts.
string sqlCommand = "USP_U_ChangeUserPassword";
Database db = DatabaseFactory.CreateDatabase();
DBCommandWrapper commandWrapper = db.GetStoredProcCommandWrapper(sqlCommand);
commandWrapper.AddInParameter("@password", DbType.String, password);
db.ExecuteNonQuery(commandWrapper)
But this way we will not get the number of affected rows.
I tried to use the overloaded ExecuteNonQuery() which returns affected rows
eg,
string sqlCommand = "spChangeName";
Database db = DatabaseFactory.CreateDatabase();
SqlParameter[] arParams = new SqlParameter[2];
SqlParameter param1 = new SqlParameter("@FName", DbType.String);
param1.Value = "Johnson22";
arParams[0] = param1;
SqlParameter param2 = new SqlParameter("@LName", DbType.String);
param2.Value = "White";
arParams[1] = param2;
int affectedRows = db.ExecuteNonQuery("spChangeName", arParams);
But this is throwing the following error
Failed to convert parameter value from a SqlParameter to a string.
Please provide me a solution for this issue
|
|
|
|
|
|
I'm wondering if you can access RowsAffected of the command wrapper, and if that would properly give you back the rows affected.
<br />
...<br />
Database db = DatabaseFactory.CreateDatabase();<br />
DBCommandWrapper commandWrapper = db.GetStoredProcCommandWrapper(sqlCommand); <br />
commandWrapper.AddInParameter("@password", DbType.String, password); <br />
db.ExecuteNonQuery(commandWrapper);<br />
<br />
int rowsAffected = commandWrapper.RowsAffected;<br />
I haven't tried this myself, so I'm sorry if I'm looking in the wrong direction.
-- modified at 20:28 Wednesday 31st August, 2005
|
|
|
|
|
Thanks Susan, your suggestion is working fine
|
|
|
|
|
FYI
I think the reason your second example did not work was because you were trying to pass in a SqlParameter array into db.ExecuteNonQuery , whereas looking at the constructor for it, it looks like it's asking for an object array of the actual values, not the parameters:
public virtual int ExecuteNonQuery(string storedProcedureName, params object[] parameterValues)
So I would guess that your second code sample should be something like:
string storedProcName = "spChangeName";<br />
Database db = DatabaseFactory.CreateDatabase();<br />
<br />
int affectedRows = db.ExecuteNonQuery(storedProcName, "Johnson22", "White");<br />
|
|
|
|
|
Hello!
I am trying to use a DLL that contains functions of c++ in c # but I have not been able to make it, this DLL is of a software called LOOX Maker, which is a editor graphic that has many options reason why I want to reuse that code and not to have to program it again, also i have the source of this program, I have tried several things but I have not obtained it. somebody that has more experience in this type of things can help me? I can send the project to you where I am trying to use it and also the DLL and source code of LOOX Maker, I hope that somebody can help me.
|
|
|
|
|
|
Hi all. I've been using C#.net for about 6 months and love it. I have several projects that I would like to roll under one project. Now, while I understand how to import the projects in to my main project, I am having a hard time calling those project forms from my main form menu and I also get an error that my main form and the other project forms have multiple entry points.
Can someone please help me understand this quandry and help me find a solution? I'm sure you genius' out there know how to fix this and are grinning as you read this.
Sincerely,
J. Barber
C#.net newby!
|
|
|
|
|