|
Stored proc is likely the only way to force selects to trigger some action. You probably also have to remove the select privilege from the schema owner.
What's the trigger supposed to do?
Chris Meech
I am Canadian. [heard in a local bar]
When I want privacy, I'll close the bathroom door. [Stan Shannon]
NOTED: The government now loses money on each penny it produces thanks to the soaring price of zinc -- the main component of the copper-coated coins. The cost of the metals in a penny rose to 0.8 cents last week, and the government spends at least another 0.6 cents to mint each one-cent coin. [The New York Times]
|
|
|
|
|
Chris Meech wrote: Stored proc is likely the only way to force selects to trigger some action. You probably also have to remove the select privilege from the schema owner.
I was thinking the same thing, but was curious if anybody had any workarounds.
Chris Meech wrote: What's the trigger supposed to do?
Basically access auditing. A data owner vendor of our decided out of nowhere that they want auditing of data access. For whatever reason I was told that security restrictions are not adequate in determining who has data access (go figure... ).
|
|
|
|
|
This is my code for INSERT data to my database:
////////////////////////////////////////////////////
Dim strconn As String = "server=fry;uid=user;password=sql;database=db"
Dim dbconn As SqlConnection = New SqlConnection(strconn)
Try
Dim dbinsert As SqlCommand = New SqlCommand("INSERT INTO Kunder(Namn,Ort) VALUES('" & txtFname.Text & "','" & txtPlace.Text & "')", dbconn)
dbconn.Open()
dbinsert.ExecuteNonQuery()
dbconn.Close()
Catch ex As Exception
Label1.Text = ex.ToString()
End Try
Refresh()
////////////////////////////////////////////////////
But how do I UPDATE a post??
-- modified at 9:18 Wednesday 3rd May, 2006
|
|
|
|
|
You need to use an UPDATE statement.
"UPDATE Kunder SET Namn='" & txtFname.Text & "',Ort='" & txtPlace.Text & "' WHERE Namn='" & cOldNamnValue & "'"
This assumes that Namn is unique in the table (otherwise it will update all records where Namn matches cOldNamnValue). If the Namn field is not unique, then you need to have some kind of identity field, and use that in the WHERE clause of your UPDATE statement.
----------
There go my people. I must find out where they are going so I can lead them.
- Alexander Ledru-Rollin
|
|
|
|
|
This code is susceptable to a SQL Injection Attack - At the very least the injected values should be replaced with parameters. See SQL Injection Attacks and Tips on How To Prevent Them[^]
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Colin Angus Mackay wrote: This code is susceptable to a SQL Injection Attack
True
I keep forgetting to remind people of that. Thanks.
BTW: Good article.
----------
There go my people. I must find out where they are going so I can lead them.
- Alexander Ledru-Rollin
|
|
|
|
|
Hi Everyone,
Can one tell tell what is the most effective way of inserting multiple data from dataset without using loop in .NET
leo
|
|
|
|
|
Hi database people.
So how can I remove duplicate rows from a table? So far I have been using:
select distinct * into NewTable from OldTable
and then removing the original table and renaming the new table to the original name.
Anyone know a better way? Thanks..
Regards,
Rob Philpott.
|
|
|
|
|
check this
http://support.microsoft.com/default.aspx?scid=kb;en-us;139444
|
|
|
|
|
Nice one. Thanks!
Regards,
Rob Philpott.
|
|
|
|
|
|
Search comments[^]
----------
There go my people. I must find out where they are going so I can lead them.
- Alexander Ledru-Rollin
|
|
|
|
|
Good point. I must learn how to do this...
Regards,
Rob Philpott.
|
|
|
|
|
Hi EveryOne,
I have created 1 table in my DB named F-orgs containg only 1 field F_orgs. And it’s the primary key. Its Data Values are
F_orgs
F01
F02
F03
F04
and other table Item_Details having F_Orgs as the foreign key.
and One Item can be used by multiple F_Orgs.
Now the prob is that:
My table Item Details is not accepting multiple values under F__orgs field. It is only taking 1 value like
Item_No F_orgs
1414-3635 F01
1414-3636 F02
I want this
Item_No F_orgs
1414-3637 F01, F02
1414-3638 F02, F03
And it is but obvious while inserting it is checkn values with F_Orgs Table (Relationship Bw F_Orgs and Item_Details Table)
Rite. So is my logic going wrong somewhere.
Can anyone have any idea, where i m going wrong.
Plz tell.
Regards
|
|
|
|
|
I think your insert should be trying to get records like this:
1414-3637 F01
1414-3637 F02
1414-3638 F02
1414-3638 F03
When you put comma separated values into a field, the DB checks that the string as a whole matches a single entry in the F_Orgs table.
|
|
|
|
|
Hi there,
2 of my table fields is an int (winery ID), and the other is ntext (winery description). The size of the int is 4, and that of ntext is 16.
When passing the parameters in a stored procedure, I thought that using a size 4 or 16 would pass the whole number, or text, but surely this is not the case. When specifying a size of 16, it cuts off on the 16th character. So what I am going to do is use objWinery.Description.Length. But how do I then pass the size/length of the int?
I have a function that createds my parameter like:
AddParameterToSQLCmd(objCmd, "@Description", SqlDbType.NText, 16, ParameterDirection.Input, objWinery.Description);
I hope this makes sense.
Regards,
ma se
|
|
|
|
|
The length of the int will always be 4 (byte size in the DB).
The ntext data is stored separately from the rest of the table data, and does not take a length parameter. The length of 16 you see in the DB refers to the byte size of the reference the db saves to the external data.
Hope that made sense...
|
|
|
|
|
Yes it does, so int will always except as parameter?
|
|
|
|
|
|
Hello, i want to know some knowledge on connecting a database within vb.net! Please can someone help me!!
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
You might like to try using a search engine for tutorials on ADO.NET
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Step 1: Turn on computer
Step 2: Open Visual Studio
Step 3: Follow MSDN links
Pictures of the menu available at the drive-thru
|
|
|
|
|
Can any one make it syntactically correct 2 use inside c#
"SELECT Word,Category,Number,Gender,Person,Degree,ObjectType,Tense,Aspect,Mood,Comp1,Comp2,Comp3,Theta1,Theta2,Theta3 FROM HindiLex,Attributes,SubCategoryFrames,ThematicFrames where HindiLex.Word = N'"+word+"'" and HindiLex.AttrNo = "Attributes.AttrNo%" and HindiLex.LexSCFNo = SubCategoryFrames.LexSCFNo and HindiLex.ThemSCFNo = ThematicFrames.ThemSCFNo";
|
|
|
|
|
You can't write a query in C#, all you can do is pass the query from C# to your database. What database are you using ? You should read some of the articles on this site, I'm sure there's one for connecting to whatever DB you use.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yes U R Right,
I wanna pass Query fm C#.
so for passing the query string syntax changes inside c#, is nt it...
i want that string syntax.
i am using SQL sERVER AS DB.
If possible pls modify to make it syntactically correct, thank U
|
|
|
|