Hello
Are you sure about the C# ?
If you want the code on Arduino , It's C language not C# .
I'm familiar with this setup and There is no problem with connecting to a DB btw ,
but where is this DB ? .. if it resides on a server , it will only take a HTTP Request to connect
the device and send the Readings to the DB .
also what type of DB ? mySql , Mongo, influxDB ?
also what Arduino ? Uno , nano , pro ?
If you have a server with a domain name , this can be extremely useful , Notifications to Android device
Emails . etc can be done easily .
Regards