That's an old concept for returning a value when actually no value can be returned (e.g. due to an error).
Here, you told the server that it must not count the rows affected. When you now ask "how many rows were affected" it cannot return the "correct" value, you ought to expect an exception, but for compatibility with legacy applications, it returns a number.
Any whole number from 0 to inifinite would pretend to be the correct result. Hence, the server must not return any value in that range. And therefore, it returns -1: it is not possible that a negative number of rows was affected.
Get used to that old concept, you may encounter it more often.
Ssql = " Select * from User_Access A Where A.User_pwd ='1234' "
set rs = Server.CreateObject("ADODB.RecordSet")
rs = DB.execute(Ssql,dbstatus)
If dbstatus <> 0 Then
'Error code here
Above is the code working ok . Actually this is written in dll. Now code will give error if "dbstatus" is other than 0 . Here I'm getting -1 always in my environment.
What a shocker. It is what the doc[^] says: For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command... For all other types of statements, the return value is -1
I want to know how can i increase the session existence time in SQL server. I have a software that uses a connection to SQL server . when it remains idle for some minutes then the new session will be created to SQL server from the application side . This produces me me a big problem . Because i use the connection_Id for auditing the user . in my login table i have applicationID that refers to connection_Id in sys.dm_exec_connections .
when the software authenticates the user , It updates the connection_ID in login table and through this column i can get my user's username in my triggers .
here is the problem
when my software becomes idle , then another connection_id is created and i can not trace my user because i can not reach my user in logins table
this is my login table
CREATE PROCEDURE [dbo].[Authenticate] (@username nvarchar(30) , @password nvarchar(30))
declare @Authenticated int
set @Authenticated = 0
select @Authenticated = 1
from Logins l
where l.LoginUser =@username and l.Password =@password
if @Authenticated = 1
declare @AppID uniqueidentifier
select @AppID=p.connection_id from sys.dm_exec_connections p
where p.session_id = @@SPID
set AppID = @AppID
where Logins.LoginUser = @username and Logins.Password = @password
select @Authenticated ,@AppID
I don't recall ever having seen a Word document that would fit in 255 bytes.
I just created a Word document containing a single letter ("a"), saved it to disk, and found a file size of 29KB. That was Word 2007 BTW.
The only type that is suited for storing binary data IMO is a "blob".
MySQL offers blob, and some size variants thereof. Use those. I never used "binary".
Yes, saving and retrieving data to/from a database is tricky; as long as it doesn't work, it is hard to tell where the problem lies; it could be in the saving part, or in the retrieving part. And when you have several bugs at once (I'm sure you do!) fixing any one of them doesn't seem to help at all, until you get to the last one.
The good thing is, you have to solve it only once, as it would apply to any kind of data, as long as it fits a byte array model, it is all the same.
And the best thing is, millions of people have done this before, so the solution is bound to be available everywhere you look.
I need your helps now.
I setup merge replication from Server A to server B and Server C and then i want to do the transaction replication from server A to another server D but i got a problem:
Publication cannot be subscribed toby Subscriber database because it contains one or more articles that have been subscribed toby the same Subscriber database at merge level.
Changed database context to (.Net SqlClient Data Provider)
If I setup only transaction replication it is working fine but when i setup Merge replication in Server A and after that i setup one more Transaction replication then i gave me the errors as mentioned.
Actually i have one server A do merge replication to clients. And now i want to do one more transaction replication in Server A to others but it occurred errors.
can we do Merge replication and transaction replication in the server A?
Basically with merge replication when a synchronization occurs, the final state of the rows is what is merged with the other side. So if I have a stock tracking table which each stock is updated thousands of times between synchronizations only the last value of the stock will be replicated.
With transactional replication with updateable subscribers the changes (the DML) will be replicated as transactions. So if a row in our stock table is updated 1,000 times there will be 1000 indivdual transactions will be replicated.
Now updateable subscribers is being deprecated and will likely not show up in SQL 11 and peer to peer is the desired upgrade path.
So if you need transactions replicated transactionally you would want updateable subscribers, if you want bi-directional synschronization between nodes which are frequently disconnected - merge replication is the way to go.
in my application
I have three tables: user, admin, operator
each of these three can send a message to another
the message can be a response to a message sent by the other
or it may correspond to a command (because the user places orders to the admin and the admin can send a message on this order (Order approved, rejected, in process))
all of that concern an application of managment printing
my problem is to determinate how much I need to message tables (because there is a lot of messages (corresponding to order, response, simple message, which is sender and receiver....))
here is the image of my model
Can you help me or give me examples of similar cases
I wrote a simple messaging application a few years ago and used something like the following:
MessageID -- the ID of message
ParentID -- the ID of the immediate parent message
ThreadID -- the ID of the first message in the thread
SenderID -- the ID of the sender
TimeSent -- timestamp
Content... (whatever other columns you require)
MessageID -- the ID of the message
RecipientID -- the ID of the recipient
This allowed for multiple recipients for each message. I used GUIDs for IDs, but you could use INTs if you like.