Click here to Skip to main content
15,911,360 members
Home / Discussions / C#
   

C#

 
GeneralRe: Public and protected property Pin
Patrick Etc.10-Oct-07 11:44
Patrick Etc.10-Oct-07 11:44 
GeneralRe: Public and protected property Pin
Skippums10-Oct-07 11:23
Skippums10-Oct-07 11:23 
GeneralRe: Public and protected property Pin
Patrick Etc.10-Oct-07 11:44
Patrick Etc.10-Oct-07 11:44 
GeneralRe: Public and protected property Pin
Robert Rohde10-Oct-07 11:45
Robert Rohde10-Oct-07 11:45 
QuestionToolStripManager.LoadSettings exception Pin
Skippums10-Oct-07 10:42
Skippums10-Oct-07 10:42 
AnswerRe: ToolStripManager.LoadSettings exception Pin
Pete O'Hanlon10-Oct-07 10:50
mvePete O'Hanlon10-Oct-07 10:50 
GeneralRe: ToolStripManager.LoadSettings exception Pin
Skippums10-Oct-07 10:57
Skippums10-Oct-07 10:57 
QuestionChecking for database concurrency violations Pin
msx2310-Oct-07 10:14
msx2310-Oct-07 10:14 
In the app I'm writing I would like to be able to check if any concurrency violations have occurred on the database it's monitoring in the recent past.
In SQL Server Management studio I can run the command
DBCC CONCURRENCYVIOLATION
which gives me the message back (where I forced concurrency violations):

Concurrency violations since 2007-10-10 10:47:47.383<br />
     1     2     3     4     5     6     7     8     9  10-100  >100<br />
  4727  2800  1118     0     0     0     0     0     0       0     0<br />
Concurrency violations will be written to the SQL Server error log.<br />
DBCC execution completed. If DBCC printed error messages, contact your system administrator.


So this is the info I need, the way that I'm trying to get it into my program is:

				conn.Open();<br />
<br />
				conn.InfoMessage += new SqlInfoMessageEventHandler(SqlMessageEventHandler);<br />
<br />
				SqlCommand c = new SqlCommand("DBCC CONCURRENCYVIOLATION", conn);<br />
				c.ExecuteNonQuery();


where conn is my SQL connection and SqlMessageEventHandler grabs the error message:

		public void SqlMessageEventHandler(object sender, SqlInfoMessageEventArgs e)<br />
		{<br />
			string CVTest = "";<br />
			foreach (SqlError err in e.Errors)<br />
			{<br />
				CVTest += err.Message;<br />
			}		<br />
<br />
		}


The problem is that the "CVTest" sting I'm using to monitor the message only gives me back

DBCC execution completed. If DBCC printed error messages, contact your system administrator.rather than the whole message as in Server Management Studio. This occurs whether the DB I'm checking has violations logged or not.

Does anyone know how I can get all the information that DBCC CONCURRENCYVIOLATION should return?

Alternatively, if anyone knows a better way to programatically check for concurrency violations that have occurred on the database that would be great, since parsing that message to determine can't be the most efficient way.

Thank you.
AnswerRe: Checking for database concurrency violations Pin
Robert Rohde10-Oct-07 11:50
Robert Rohde10-Oct-07 11:50 
GeneralRe: Checking for database concurrency violations Pin
msx2311-Oct-07 12:30
msx2311-Oct-07 12:30 
QuestionHow to convert a char from IO stream into an int please Pin
humblepgmr10-Oct-07 9:46
humblepgmr10-Oct-07 9:46 
AnswerRe: How to convert a char from IO stream into an int please Pin
Pete O'Hanlon10-Oct-07 9:49
mvePete O'Hanlon10-Oct-07 9:49 
GeneralRe: How to convert a char from IO stream into an int please Pin
humblepgmr10-Oct-07 10:05
humblepgmr10-Oct-07 10:05 
GeneralRe: How to convert a char from IO stream into an int please Pin
Matthew Cuba10-Oct-07 10:18
Matthew Cuba10-Oct-07 10:18 
QuestionSet a psw to a directory Pin
mcaos10-Oct-07 9:30
professionalmcaos10-Oct-07 9:30 
QuestionRe: Set a psw to a directory Pin
TJoe10-Oct-07 9:33
TJoe10-Oct-07 9:33 
AnswerRe: Set a psw to a directory Pin
Giorgi Dalakishvili10-Oct-07 9:42
mentorGiorgi Dalakishvili10-Oct-07 9:42 
AnswerRe: Set a psw to a directory Pin
mcaos10-Oct-07 10:43
professionalmcaos10-Oct-07 10:43 
GeneralRe: Set a psw to a directory Pin
Dave Kreskowiak10-Oct-07 15:08
mveDave Kreskowiak10-Oct-07 15:08 
GeneralRe: Set a psw to a directory Pin
TJoe11-Oct-07 2:35
TJoe11-Oct-07 2:35 
GeneralRe: Set a psw to a directory Pin
mcaos13-Oct-07 6:43
professionalmcaos13-Oct-07 6:43 
Questionms office current open files Pin
s3rro10-Oct-07 9:16
s3rro10-Oct-07 9:16 
Questionredirect printf from unmanaged DLL to C# textbox Pin
Daemon Black10-Oct-07 9:13
Daemon Black10-Oct-07 9:13 
AnswerRe: redirect printf from unmanaged DLL to C# textbox Pin
Dave Kreskowiak10-Oct-07 15:11
mveDave Kreskowiak10-Oct-07 15:11 
QuestionGet an object value using a string Pin
MrEyes10-Oct-07 8:15
MrEyes10-Oct-07 8:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.