Search
 
SCRIPT & CODE EXAMPLE
 

SQL

c# sql select

SqlConnection conn = new SqlConnection("Data Source=;Initial Catalog=;Persist Security Info=True;User ID=;Password=");
conn.Open();

SqlCommand command = new SqlCommand("Select id from [table1] where name=@zip", conn);
command.Parameters.AddWithValue("@zip","india");
 // int result = command.ExecuteNonQuery();
using (SqlDataReader reader = command.ExecuteReader())
{
  if (reader.Read())
  {
     Console.WriteLine(String.Format("{0}",reader["id"]));
   }
}

conn.Close();
Comment

c# Select MSSQL

DataSet ds = new DataSet();
//https://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/ODPNET_Core_get_started/index.html
using (SqlConnection con = new SqlConnection(connectionstr))
{
    using (SqlCommand cmd = con.CreateCommand())
    {
        con.Open();
        cmd.CommandText = "select * from master.sys.server_principals";
        SqlDataAdapter adapter = new SqlDataAdapter(cmd);
        adapter.Fill(ds);
    }
}
Comment

c# Select MSSQL


SqlConnection conn = new SqlConnection("Data Source=;Initial Catalog=;Persist Security Info=True;User ID=;Password=");
conn.Open();

SqlCommand command = new SqlCommand("Select id from [table1] where name=@zip", conn);
command.Parameters.AddWithValue("@zip","india");
 // int result = command.ExecuteNonQuery();
using (SqlDataReader reader = command.ExecuteReader())
{
  if (reader.Read())
  {
     Console.WriteLine(String.Format("{0}",reader["id"]));
   }
}

conn.Close();

Comment

PREVIOUS NEXT
Code Example
Sql :: child row: a foreign key constraint fails 
Sql :: mysql streaming example 
Sql :: md5 encryption for existing records 
Sql :: tsql select everything before a character 
Sql :: oracle timestamp +1h 
Sql :: select from another database 
Sql :: pypi sqlparse 
Sql :: pagination with row_number 
Sql :: get the next column of a table in mysql 
Sql :: default order by in mysql 
Sql :: sqlite3 not commit 
Sql :: in operator sql 
Sql :: 9999 
Sql :: mysql convert charset 
Sql :: how to set all the min and sec data to zero in sql server 
Sql :: mysql where sum 0 
Sql :: mysql error 1215 
Sql :: truncate syntax in sql 
Sql :: create bakupd database sqlserver 
Sql :: mysql select max and corresponding row 
Sql :: postrgres trunc 
Sql :: mysql portable 
Sql :: cross apply top for each row t1 
Sql :: selects all the columns from the sailors table 
Sql :: postgres docs /copy metacomand 
Sql :: dataframe lambda elif 
Sql :: sqlite send a query to a Sqlite DB with Ruby 
Sql :: declare row variable sql server 
Sql :: mysql count with two joins 
Sql :: representation arbres de requete en postgresql 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =