.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Sgraph Infotech
Imran Ghani
Post New Web Links

How to add sql

Posted By:      Posted Date: October 02, 2010    Points: 0   Category :ASP.Net
 

 DataTable dt = new DataTable();
            string Priimek = string.Empty;
            string Ime = string.Empty;
            string newName = string.Empty;

            string NazivVozila = string.Empty;
            string RegistrskaStevilka = string.Empty;
            string TipVozila = string.Empty;


            SqlConnection connection = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\ASPNETDB.MDF;Integrated Security=True;User Instance=True");
            try
            {

                //

                connection.Open();
                string sqlStatement = "SELECT tbl_zaposleni*, tbl_avtomobili.* FROM  tbl_zaposleni INNER JOIN tbl_avtomobili";
                SqlCommand sqlCmd = new SqlCommand(sqlStatement, connection);
                SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd);
                sqlDa.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        Priimek = dt.Rows[i]["Priimek"].ToString();
                        Ime = dt.Rows[i]["Ime"].ToString();
                        newName = Priimek + " " + Ime;
                        DropDownList1.Items.Add(new ListItem(newName));
                     //   DropDownList3


View Complete Post


More Related Resource Links

Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend