I am trying to connect to the SQL database in my network using the code below. I've searched on Stackoverflow and web for this error and found so many other people experiencing this issue, applied and tested many none fixed my issue. Currently the code I have is below:
using System;
using System.Data.SqlClient;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
using ( SqlConnection conn = new SqlConnection)
{
conn.ConnectionString = "Server=***;Database=***;Trusted_Connection=True;";
}
}
}
}
In the place of *** I have server and database names. Also, where do I enter the specific table?
()afternew SqlConnection.using (SqlConnection conn new SqlConnection())(note extra parentheses) - but: the error suggests the problem is resolving the type itself; is this a missing reference? Are you referencing System.Data? or if this is .NET Core: System.Data.SqlClient (package reference)?command.CommandText="SELECT * FROM table WHERE id = " + Textbox1.Text;and the fight to save another developer from spending the next 5 years writing insecure, low quality database access code will be lost :/