A1VBCode Forums

how to create check availabilty coding.....


http://www.a1vbcode.com/vbforums/Topic24360.aspx

By mimithebest - 3/6/2008

hello sir....i'm new in C# languange....so that i want to ask how to create check availbility coding...the situation of my problem is i need to check availbility for some equipment whether available or not....



one more question...how i can add data in SQL server using vb.net C# language.... thats mean when the customer fill all the information,all information can be inserted in database.....Crying help me.....
By paul daniel - 12/22/2009

Hi code for inserting datas in sql server using c#



Code as follows:



string ConnString = ConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString;

SqlConnection Conn = new SqlConnection(ConnString);

SqlCommand Cmd = new SqlCommand("INSERT INTO TableName(column1,column2)VALUES(@column1,column2)", Conn);





Cmd.Parameters.Add("@column1", System.Data.SqlDbType.VarChar);

Cmd.Parameters["@column1"].Value = ddlDepartment.SelectedValue;

Cmd.Parameters.Add("@column2", System.Data.SqlDbType.VarChar);

Cmd.Parameters["@column2"].Value = rblBuildingType.SelectedItem.Value;







try



{



conn.Open();



Cmd.executeNonQuery();



lblResultSuccess.Text="Successfully Submitted";



}



catch(Exception Ar)



{



Response.Write(Ar.Message);



lblResult.Text="Error";



}



finally



{



Conn.Close();



}











Happy Coding, Enjoy Smile



.Net Application Development