Connecting to the db automatically according to the current month
-
Hi, I am using .net 2.0 & Sqlserver 2005. I have databases for the months, i.e., I have to insert recrods into the db of the current month. For example I can insert and handle records from October db only when the current month is October. But this should happen automatically. Users don't have permissions to change the db. I don't have idea to implement this. Please help me to implement this. Thanks.
-
Hi, I am using .net 2.0 & Sqlserver 2005. I have databases for the months, i.e., I have to insert recrods into the db of the current month. For example I can insert and handle records from October db only when the current month is October. But this should happen automatically. Users don't have permissions to change the db. I don't have idea to implement this. Please help me to implement this. Thanks.
Hi Kandalu, All the element in the connection string will be same you only have to replace the database name for each month. So just get the curreent month and update the connection string dynamicaly so that the recrods can be insrerted for the current month. Thanx
-
Hi Kandalu, All the element in the connection string will be same you only have to replace the database name for each month. So just get the curreent month and update the connection string dynamicaly so that the recrods can be insrerted for the current month. Thanx
Hi HemJoshi, Thanks for your quick reply. I thought like you. But I don't know where to set the connection string either as an application variable or at the page load event? In .net if we change the current date, the changed date only appear when we use the "DateTime.Now()" function. I don't know how to get the correct date whenever the user change the date. Could you tell me how to implement this? Thanks.
-
Hi HemJoshi, Thanks for your quick reply. I thought like you. But I don't know where to set the connection string either as an application variable or at the page load event? In .net if we change the current date, the changed date only appear when we use the "DateTime.Now()" function. I don't know how to get the correct date whenever the user change the date. Could you tell me how to implement this? Thanks.
-
Hi kandalu, do not use DateTime.Now()it will fatch the client current date.Create a procedure at database side which will return the current date(using getdate()).This will always return the cureent date of the database server. Thanks