return ConfigurationManager.AppSettings[@"Data Source=LENOVO-74FE9906\SQLEXPRESS;AttachDbFilename=D:\Farrukh\Orignal Project\Inventory Management System\IMS.mdf;Integrated Security=True"];
in above statement you have used ConfigurationManager.AppSettings which is used to take values for any key defined in config file and takes key name as parameter in square bracket.
now you have provided whole connection string in square brackets but when this line of code will get executed, it will search for a key with name as provided in config file and as there is no any key with this name, it will return null and hence the error.
if you want to hardcode connection string here then don't use ConfigurationManager.Appsettings just use like below
return @"Data Source=LENOVO-74FE9906\SQLEXPRESS;AttachDbFilename=D:\Farrukh\Orignal Project\Inventory Management System\IMS.mdf;Integrated Security=True";
as a second case you can define a key in config file and put its name here in your code file. like below
return ConfigurationManager.AppSettings["ConfigKeyName"]
Hope it helps you.