You are on page 1of 1

using

using
using
using
using
using
using
using
using

System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Data.SqlClient;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;

namespace winLocadora
{
public partial class FrmPrincipal : Form
{
public FrmPrincipal()
{
InitializeComponent();
}
private void FrmPrincipal_Load(object sender, EventArgs e)
{
this.Text = Application.ProductName;
SqlConnection cnn = new SqlConnection(@"Data Source=LAB414\SQLEXPRES
S;User ID=aluno;Password=123;Initial Catalog=locadora");
SqlCommand cmd = new SqlCommand("Select TITULO from TITULOS",cnn);
SqlDataReader dr;// = new SqlDataReader();
cnn.Open();
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
while (dr.Read())
{
MessageBox.Show(dr.GetValue(0).ToString());
}

You might also like