hi friends, On Today Morning i go through with Custom Error Message in MSSql server. for that i work around below step and it's done man. i found one stored procedure "sp_addmessage" which used for adding my custome error message on server.. USE master GO EXEC sp_addmessage 50002, 10, N'The data %s already exists!' GO RAISERROR (50002, 10, 1, 'MyText') syntax for sp_addmessage is sp_addmessage [ @msgnum= ] msg_id , [ @severity= ] severity , [ @msgtext= ] 'msg' [ , [ @lang= ] 'language' ] [ , [ @with_log= ] { 'TRUE' | 'FALSE' } ] [ , [ @replace= ] 'replace' ] [ @msgnum= ] msg_id Is the ID of the message. msg_id is int with a default of NULL. msg_id for user-defined error messages can be an integer between 50,001 and 2,147,483,647. The combination of msg_id and language must be unique; an error is returned if the ID already exists for the specified language. [ @severity = ]se...
Method Overloading ------------------ Method Overloading means having two or more methods with the same name but different signatures in the same scope. These two methods may exist in the same class or one in base class and another in the derived class. The signature of a function is determined by 3 factors: a) Number of arguments received by the function. b) Data types of the parameters/arguments. c) Position/order of the arguments. The signature of a function never depends upon the return type. Two functions differ only in their return type cannot be overloaded. Example of Method Overloading ----------------------------- public partial class _Default : System.Web.UI.Page { protected void Button1_Click(object sender, EventArgs e) { MyBaseClass mbc = new MyBaseClass(); Response.Write(mbc.AddNumbers(1,2).ToString()); Response.Write("<br />" + mbc.AddNumbers(1, 2, 3).ToString()); } } public class MyBaseClass { public int AddNumb...
bulk insert into sqlserver using textfile Bulk insert sql server 2008 example I find so many issues while inserting bulk record in database.. Need to create temp table than I has to map all fields which is in file and in table than Insert it in to actual table but here is one Master command to insert record in bulk through simple statement.. Step 1 ) Create Table. create table AddressBook (id int,name varchar(50),address varchar(50)) Step 2) Create Text file with “,” delimiter. 1,John,India 2,Raj,India 3,Sonal,India 4,Roshan,India Step 3) Bulk insert record in to AddressBook table bulk insert AddressBook from 'c:\Addressbook.txt' with ( fieldterminator = ',' , rowterminator = '\n' )
Comments