Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

conectarte a una base de datos con .net (See related posts)

// description of your code here

SqlConnection conn = null;
SqlCommand cmd = null;
SqlDataReader dr = null;

String s = null;
Product prod = null;

try
{
	conn = new SqlConnection("Provider=SQLOLEDB;SERVER=sissql2;UID=sa;PWD=AlfaRoma440;DATABASE=genericatest2");

	s = " ";


	cmd = new SqlCommand(s,conn);
	dr = cmd.ExecuteReader();
	// lleno el objeto producto

	while( dr.Read())
	{

	}


}
catch (Exception ex)
{
	// poner el manejo de errores	
}
finally
{
	dr.Close();
	conn.Close();
}
dr.Close();
conn.Close();
return prod;
}

You need to create an account or log in to post comments to this site.


Click here to browse all 4861 code snippets

Related Posts