Monday, 20 April 2020

India - All State Name in Json format

{
"AN":"Andaman and Nicobar Islands",
"AP":"Andhra Pradesh",
"AR":"Arunachal Pradesh",
"AS":"Assam",
"BR":"Bihar",
"CG":"Chandigarh",
"CH":"Chhattisgarh",
"DN":"Dadra and Nagar Haveli",
"DD":"Daman and Diu",
"DL":"Delhi",
"GA":"Goa",
"GJ":"Gujarat",
"HR":"Haryana",
"HP":"Himachal Pradesh",
"JK":"Jammu and Kashmir",
"JH":"Jharkhand",
"KA":"Karnataka",
"KL":"Kerala",
"LA":"Ladakh",
"LD":"Lakshadweep",
"MP":"Madhya Pradesh",
"MH":"Maharashtra",
"MN":"Manipur",
"ML":"Meghalaya",
"MZ":"Mizoram",
"NL":"Nagaland",
"OR":"Odisha",
"PY":"Puducherry",
"PB":"Punjab",
"RJ":"Rajasthan",
"SK":"Sikkim",
"TN":"Tamil Nadu",
"TS":"Telangana",
"TR":"Tripura",
"UP":"Uttar Pradesh",
"UK":"Uttarakhand",
"WB":"West Bengal"
}

Saturday, 11 April 2020

How to use Way2Sms api in C#

public void send(string message, string no)
{

HttpWebRequest myReq =
// (HttpWebRequest)WebRequest.Create("http://ubaid.tk/sms/sms.aspx?uid=" + uid + "&pwd=" + password +
//"&msg=" + message + "&phone=" + no + "&provider=way2sms");
(HttpWebRequest)WebRequest.Create("puturlink = "+"UrUsername"+ "&password=" + "UrPassword" + "&sender=" +"UrSenderID"+ "&to=" +no+ "&message=" + message+ "&reqid=1&format={json|text}&route_id=route+id&callback=Any+Callback+URL&unique=1&sendondate=" +"10-10-2014T05:17:52"+"");
HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());
string responseString = respStreamReader.ReadToEnd();
respStreamReader.Close();
myResp.Close();
}

//Button Click code
protected void btn_send_Click(object sender, EventArgs e)
{

send(txt_message.Text, txt_mobile.Text);

ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('sms sent successfully...');", true);

}

Sunday, 5 April 2020

EXEC sp_configure for SP procedure

EXEC sp_configure 'Ole Automation Procedures';
GO

sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1;
GO
RECONFIGURE;
GO


3
4
5
6
7
8
9
10
11
DECLARE @status int
DECLARE @responseText as table(responseText nvarchar(max))
DECLARE @res as Int;
DECLARE @url as nvarchar(1000) = 'https://www.google.it'
EXEC sp_OACreate 'MSXML2.ServerXMLHTTP', @res OUT
EXEC sp_OAMethod @res, 'open', NULL, 'GET',@url,'false'
EXEC sp_OAMethod @res, 'send'
EXEC sp_OAGetProperty @res, 'status', @status OUT
INSERT INTO @ResponseText (ResponseText) EXEC sp_OAGetProperty @res, 'responseText'
EXEC sp_OADestroy @res
SELECT @status, responseText FROM @responseText

Sunday, 15 March 2020

how to create user in sql server and grant select permission only


Follow the 4 steps for creating user and grant permission:

Example:

step 1: create LOGIN rochelle with password ='admin@123'
step 2: use DatabaseName
step 3: create user s_rochelle for login rochelle
step 4: grant select to s_rochelle
Step 5: GRANT SELECT ON SCHEMA :: wmwhse2 TO DBUAT02 WITH GRANT OPTION;

Wednesday, 11 March 2020

Create new APPPOOL in sql server

IF NOT EXISTS (SELECT name FROM sys.server_principals WHERE name = 'IIS APPPOOL\MLM')
BEGIN
    CREATE LOGIN [IIS APPPOOL\MLM]
      FROM WINDOWS WITH DEFAULT_DATABASE=[master],
      DEFAULT_LANGUAGE=[us_english]
END
GO
CREATE USER [MLMWebDatabaseUser]
  FOR LOGIN [IIS APPPOOL\MLM]
GO
EXEC sp_addrolemember 'db_owner', 'MLMWebDatabaseUser'
GO

redirect to new page from jquery

  function foo(id) { var url = ' @Url . Action ( "Details" , "Branch" , new { id = "__id__" })'...