Click here to Skip to main content
15,889,462 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: locate the FILESTREAM data Pin
Dave Kreskowiak3-Dec-13 15:01
mveDave Kreskowiak3-Dec-13 15:01 
GeneralRe: locate the FILESTREAM data Pin
Pete O'Hanlon3-Dec-13 19:18
mvePete O'Hanlon3-Dec-13 19:18 
GeneralRe: locate the FILESTREAM data Pin
Member 103249743-Dec-13 23:16
Member 103249743-Dec-13 23:16 
QuestionAccess to SQL Pin
Member 103884942-Dec-13 1:04
Member 103884942-Dec-13 1:04 
AnswerRe: Access to SQL Pin
Simon_Whale2-Dec-13 1:09
Simon_Whale2-Dec-13 1:09 
GeneralRe: Access to SQL Pin
Member 103884942-Dec-13 1:12
Member 103884942-Dec-13 1:12 
GeneralRe: Access to SQL Pin
Member 103884942-Dec-13 1:21
Member 103884942-Dec-13 1:21 
GeneralRe: Access to SQL Pin
Simon_Whale2-Dec-13 1:27
Simon_Whale2-Dec-13 1:27 
assuming you are using SQL Server I would have a read of these

ADO.NET Code examples[^]
connectionstrings[^]

but a simple example would be as follows

C#
string Query = "select * from someTable where id = @id";

//Replace the "ConnectionString" with your actual connection string
using(SqlConnection dbase = new SqlConnection("ConnectionString"))
{
  dbase.Open();
  
  SqlCommand cmd = new SqlCommand(Query, dbase);
  cmd.Parameters.AddWithValue(@id, 10);  //should really replace the number 10 with a variable
  SqlDataReader rdr = cmd.ExecuteReader();

  if(rdr.HasRows)
  {
    while(rdr.Read())
    {
      //output my data here
    }
  }
}


if you want to use datatables its very similar

C#
string Query = "select * from someTable where id = @id";
DataTable dt = new DataTable();

//Replace the "ConnectionString" with your actual connection string
using(SqlConnection dbase = new SqlConnection("ConnectionString"))
{
  dbase.Open();
  
  SqlCommand cmd = new SqlCommand(Query, dbase);
  cmd.Parameters.AddWithValue(@id, 10);  //should really replace the number 10 with a variable
  dt.Load(cmd.ExecuteReader());
}


hope this helps you start to convert your rountine to work with SQL Server
Every day, thousands of innocent plants are killed by vegetarians.

Help end the violence EAT BACON

GeneralRe: Access to SQL Pin
Member 103884942-Dec-13 2:15
Member 103884942-Dec-13 2:15 
GeneralRe: Access to SQL Pin
Simon_Whale2-Dec-13 3:04
Simon_Whale2-Dec-13 3:04 
GeneralRe: Access to SQL Pin
Member 103884942-Dec-13 3:06
Member 103884942-Dec-13 3:06 
GeneralRe: Access to SQL. Pin
Member 103884942-Dec-13 2:19
Member 103884942-Dec-13 2:19 
GeneralRe: Access to SQL. Pin
Dave Kreskowiak2-Dec-13 2:47
mveDave Kreskowiak2-Dec-13 2:47 
QuestionRtf,vb.net Pin
srinivasankrishnaa22-Nov-13 4:49
srinivasankrishnaa22-Nov-13 4:49 
AnswerRe: Rtf,vb.net Pin
Dave Kreskowiak22-Nov-13 6:20
mveDave Kreskowiak22-Nov-13 6:20 
AnswerRe: Rtf,vb.net Pin
Eddy Vluggen28-Nov-13 9:41
professionalEddy Vluggen28-Nov-13 9:41 
Questionwindow form to wpf Pin
Member 1026351918-Nov-13 22:41
Member 1026351918-Nov-13 22:41 
AnswerRe: window form to wpf Pin
Abhinav S18-Nov-13 22:47
Abhinav S18-Nov-13 22:47 
Question.net4.0 Pin
Member 1026351918-Nov-13 18:27
Member 1026351918-Nov-13 18:27 
AnswerRe: .net4.0 Pin
Abhinav S18-Nov-13 22:46
Abhinav S18-Nov-13 22:46 
AnswerRe: .net4.0 Pin
joginder-banger15-Dec-13 8:13
professionaljoginder-banger15-Dec-13 8:13 
QuestionBound Datagridview Column Which Shows Name instead of ID. Pin
Dinesh Prajapati15-Nov-13 1:49
Dinesh Prajapati15-Nov-13 1:49 
AnswerRe: Bound Datagridview Column Which Shows Name instead of ID. Pin
Richard MacCutchan15-Nov-13 2:52
mveRichard MacCutchan15-Nov-13 2:52 
GeneralRe: Bound Datagridview Column Which Shows Name instead of ID. Pin
Dinesh Prajapati15-Nov-13 9:43
Dinesh Prajapati15-Nov-13 9:43 
GeneralRe: Bound Datagridview Column Which Shows Name instead of ID. Pin
Richard MacCutchan17-Nov-13 22:18
mveRichard MacCutchan17-Nov-13 22:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.