MS-SQL: Changing single user Database to multi users

22 בנובמבר 2008

The problem: Changes to the state or options of database "DatabaseName" cannot be made at this time. The database is in single-user mode, and a user is currently connected to it.   The solutions: use mastergo alter database "DatabaseName" set multi_user;   If there's users connected to the Database and you don't know who, you can use "sp_who2" to check who's connected.   You can kill only user process by there SPID: kill 15;
תגיות: ,
תגובה אחת

First Impression: Oracle g11 Developer Tools

19 בנובמבר 2008

The g11 release of Oracle Developers Tools (ODT) includes powerful features integrated with Visual Studio. I must say that this is a major change, the features included in this version makes the common developing and database maintenance much easier.   Its supports: Visual Studio 2008/2005/2003 Oracle database version 9.2 and later Enhanced integration with Visual Studio 2008 and Visual Studio 2005     An Oracle Database Project to provide source control of Oracle SQL scripts       Integration with Microsoft Query Designer     Read more...
תגיות: ,
אין תגובות

Generic EventArgs<T>

18 בנובמבר 2008

A good way for passing data with EventArgspublic class EventArgs<TValue1> : EventArgs { public TValue1 Value1 { get; set; } public EventArgs(TValue1 value1) { Value1 = value1; } } Should you want to pass 2 valuespublic class EventArgs<TValue1, TValue2> : EventArgs<TValue1> { public TValue2 Value2 { get; set; } public EventArgs(TValue1 value1, TValue2 value2) : base(value1) { Value2 = value2; ...
תגיות: , , ,
אין תגובות

Extension Methods: IDataReader.GetValue<T>

17 בנובמבר 2008

A convenient solution to get value from IDataReader field./// <summary> /// Gets the reader field value. /// </summary> /// <typeparam name="TField">The type of the field.</typeparam> /// <param name="reader">The reader.</param> /// <param name="fieldName">Name of the field.</param> /// <returns></returns> public static TField GetValue<TField>(this IDataReader reader, string fieldName) { //Guard if (string.IsNullOrEmpty(fieldName)) throw new ArgumentException("fieldName"); return (TField)reader.GetValue(reader.GetOrdinal(fieldName)); } Usage:IDataReader reeader = _database.ExecuteReader(command); if (reader.Read()) { int productId = reader.GetValue<int>("ProductId"); }
תגיות: , , ,
4 תגובות