|
hi,
i have no problems on connecting to a database, i´m also ok on coding the user´s acess to the database (using store procedures).
But, when i copy a database from my computer and attach to sql server in other computer they can see what is in it!
i dont know how to get a connection_string that ask for the user and password since i enter my sql server by windows validation.
the connection_strings for my databases don´t require passwords!!!
do i have to make other logins in my sql server? and how?
thanks
|
|
|
|
|
A better practice would be to create a SQL login to your database (see books online for the details) and then use this login/password in your querystring in the application. This way you can limit what that one SQL user can see in the database.
The idea then is that you just manage 1 SQL user for your application instead of many windows user ids.
|
|
|
|
|
The best option in my opinion is to use windows groups to limit user access. It still uses windows authentication so no password verification etc, and you can then grant explicit permissions to the group. You can deny permissions as well as grant them, so deny select, insert, update, delete on your tables and grant exec on the stored procs.
Its a standard way of doing it and easy to maintain by scripts.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Im trying to write a SQL query to populate a XML data feed. I have the query working but they need nodes with prefixes like "media:description" and "live:publocation"
I tried
SELECT RTRIM(Title) AS Title, [Description], Url AS link, DateCreated AS pubDate,
thumbnail AS 'media:thumbnail'
FROM dbo.Videos FOR XML PATH('item'), ROOT('media'))
but that does not work. Anyone done this before?
modified on Wednesday, July 9, 2008 2:06 PM
|
|
|
|
|
I'm not sure I understood what you need... Try this:
WITH XMLNAMESPACES ('uri1' as media, 'uri2' as live)
SELECT RTRIM(Title) AS 'media:title'
, [Description] AS 'media:description'
, Url AS 'live:link'
, DateCreated AS 'media:pubdate'
, thumbnail AS 'media:thumbnail'
FROM dbo.Videos FOR XML PATH('item'), ROOT('root')
|
|
|
|
|
I am somewhat of a novice, so please forgive me if the phrasing of this question isn't clear.
I am working with an SSEE 2005 db and have imported the first of many tables into my Visual C# 2008 EE data sources. I have based a control on this datasource and everything works great.
The table in the db has, along with a primary key, a unique index. I went into the IDE and updated the proper field's Unique property to True and once again it works great. I get a message when I try to duplicate a value in that field.
My question, though, is how do I change the message? Basically I'm looking the for the event code that fires when a DataSet validation rule is broken. Are they all the same (meaning the same event no matter what the error) or is there a unique error event that happens when a Unique constraint is broken? Also, is it handled by the individual tables or from the master dataset?
Any help would be much appreciated.
|
|
|
|
|
You mean something like "violation of index idx_unq_foo cannot insert duplicate key" you want to change that? Its a global you can find by running SELECT * FROM master.dbo.sysmessages WHERE description like '%error%'
The best method to make a customized message is the use a try catch in c# and catch SQLException. customize the message based on the exception type.
|
|
|
|
|
I am creating a new record in the database.
The key is an identity field and the database is set to not allow inserts of assigned values.
I need to return the results of the INSERT to the user.
Is there anything I can do in my SQL that will let me return that key value? Is there something like a @PrimaryKey?
Thanks
|
|
|
|
|
MySQL
Select last_insert_id()<br />
MSSQL
Select SCOPE_IDENTITY()<br />
|
|
|
|
|
Hi,
I need to work with SSRS & SSIS. Thinking that this will be available along with Visual Studio .Net 2008, I have installed the same. But to my surprise, I couldn't find SSRS or SSIS under Reporting Services other than Crystal Reports. How can I install the same? Is it available along with VS 2008 or coming seperately? Please provide any help.
Thanks in advance
meeram395
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
You might want to read this: http://technet.microsoft.com/en-us/sqlserver/cc314973.aspx[^]
“If we are all in agreement on the decision - then I propose we postpone further discussion of this matter until our next meeting to give ourselves time to develop disagreement and perhaps gain some understanding of what the decision is all about.”-Alfred P. Sloan
|
|
|
|
|
project:Visual Studio 2005 ASP.NET with C#
i want to increment my database values with button.
EXAMPLE:
i have sql database in my project.
column.....gold stone place
madde: 10 10 10
when U clicked button
every column inc+10 or +20.
button is in default.aspx page.
which code can i use in button. i did not do it.
|
|
|
|
|
This is not the right forum to ask this question. Post it in ASP.Net forum
In Asp.Net, just declare a integer variable and then increment it with 1 , like
int i = 0; i++.
In sql server, you can use the Identity columns for increasing automatically. By default it will increment by 1.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
modified on Wednesday, July 9, 2008 6:47 AM
|
|
|
|
|
I have the following XML, and I need to copy the Workflow related data i.e Name and Descriptin and Module name in Workflow Master table
Level Number, NumberOfActors in Level Master table,
Rule Action, LevelNumberAfterAction, StateAutoChangeDuration in Rule Master table.
I want to do this in Oracle, and passing this XML as input to stored procedure.
Please let me know how to do this.
<workflow name="" description="" moduename="">
<levels>
<level number="1" numberofactors="1">
<rules>
<rule action="SUBMIT" levelnumberafteraction="2" stateautochangeduration="">
<notification>
<message to="REQUESTER" body="Request has been submitted" subject="CSRM Request Notification" address="">
<message to="OTHERS" body="A new CSRM request has been raised" subject="CSRM Request Notification" address="kalyana_vb@rediffmail.com">
<level number="2" numberofactors="*">
<rules>
<rule action="APPROVE" levelnumberafteraction="3" stateautochangeduration="2">
<notification>
<message to="REQUESTER" body="Request has been approved at level 2" subject="CSRM Request Notification" address="">
<message to="RECEIVER" body="There is a new request pending with you" subject="CSRM Request Notification" address="">
<rule action="REJECT" levelnumberafteraction="1" stateautochangeduration="">
<notification>
<message to="REQUESTER" body="Request has been rejected at level 2" subject="CSRM Request Notification" address="">
<message to="RECEIVER" body="Request has been rejected at level 2" subject="CSRM Request Notification" address="">
|
|
|
|
|
hello all,
I'm getting this error when connecting to my sql server 2005 with asp.net 2.0
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: Shared Memory Provider, error: 40 - Could not open a connection to SQL Server) (.Net SqlClient Data Provider)
Regards
Amit Agarwal
|
|
|
|
|
if your database service running and you can use it on local machine that could be wrong connection string(user/pass/server) or sql ports being blocked by firewall on server.
I Wish the Life Had CTRL-Z
Wizard's First Rule : People are fool,they believe what they want to believe or what they afraid to believe
www.subaitech.blogspot.com
|
|
|
|
|
I am having DataBase1
In that i am having many tables.
Table1
table2
table3.....
I want to know weather table2 exists or not.
If not i need to create the table.
So can any one tell me how to find the weather the table i am looking for exists are not
|
|
|
|
|
If you are using SQL Server (you haven't said) then
if not exists (select 1 from sysobjects where xtype = 'U' and name = 'table2')
begin
create table table2.......
end
will do it. There are several other ways too.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Another way to do it is (just replace your object names in the carrots):
If Object_Id('<database>.<schema>.<table>') Is Not Null
Begin
Create Table...
End
Which is pretty much the same as posted above, it's just using a system function. It can also work with temp tables:
--Assuming that #table is the temp table name.
If Object_Id('tempdb..#table') Is Not Null
...
|
|
|
|
|
Hi,
I have a c# (.Net 2) program that connects to access mdb file.
I use strong typed dataset to do this.
Now I have searched the web and found ms sql connection string
I replaced what was generated by the wizard with the new one and
now I can successfully connect to MS SQL server (with the same table).
The problem starts when I try to delete rows from the table.
In access it works great obviously, But with MS SQL I get exception when calling udpate (Wrong syntax near '.').
Is it possible at all to use strong typed datasets to connect to both MS SQL and ACESS. If yes how?
Thanks,
Yaniv
|
|
|
|
|
The SQL syntax is different between Access and SQL server. You are not going to be able to just change connection strings - you will need to duplicate some/all your SQL statements to conform with the TSQL syntax.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
Thanks for your reply.
I ran the sql query: DELETE FROM table1 WHERE id = 1
on both access and ms sql and it worked fine.
But I don't create the queries manually, It is created by the adapter (I think) of my strong typed database ( so I don't know whats really going there).
Is there a way I can view the query created by it?
Sincerely yours
Y.R.
|
|
|
|
|
Y_R wrote: But I don't create the queries manually
This where you have a problem. You are using the MS built in tools and therefore have only limited knowledge and understanding of the mechanics of the database and the DAL.
I suggest you completely reengineer your application to use a proper data access layer where you have control and understanding of the DAL and database operations.
As for
Y_R wrote: Is there a way I can view the query created by it?
I have absolutely no idea (but would expect it to be there somewhere) as I have only used the built in stuff enough to identify what a disaster it can be.
BTW this is not a rant against you, everyone has to start somewhere and you have asked intelligent questions and shown a willingness to learn. Do some reasearch into DALs, there are plenty of examples around.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Before we started the project we checked and found strong typed datasets the most fitting solution, Though some people strongly advised against it.
I works fine in a different area of my project (With mysql), So I don't know why people dislike it so much, But I have little experience with databases so I guess you have your reasons.
Anyway, For my specific problem I will do as you suggested and further my research in to the DALs.
Thank you very much you really helped me.
Sincerely yours
Y.R.
|
|
|
|
|
hi, All
please,, correct this sql statement (select column name1 ,count(column name2) from table name where columnname2='1',column name3 from table name )..
thanks for all person who help me.....
|
|
|
|