Note that there are some explanatory texts on larger screens.

plurals
  1. POThere is no problem in code but the output is nothing
    text
    copied!<p>how are you,sir my code is correct means there is no error after debugging that code.My goal is that if the user click on button(which is placed in default.aspx,for example)then the database table is created in database(database placed within sql express),I write the code for that purpose we debug the code and there is no error in the code .when i click the button(in runtime).when i check the database(which is in the sql express)there is no table is created in that database.please sir solve my problem.The code written in c# behind the button is that:</p> <pre><code>using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; //using PractiseWeb.DataSet1TableAdapters; using System.Collections.Generic; using System.Data.OleDb; using System.Diagnostics; using System.ComponentModel; using System.Text; using System.Data.SqlClient; using System.Data.Odbc; using ADOX; using ADODB; public partial class _Default : System.Web.UI.Page { SqlConnection conn; SqlCommand cmd; string connectionString = ConfigurationManager.ConnectionStrings["gameConnectionString"].ConnectionString; protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { try { conn = new SqlConnection(connectionString); if (!(conn.State == ConnectionState.Open)) { conn.Open(); } string sql = "CREATE TABLE mySchoolRecord(StudentId INTEGER CONSTRAINT PkeyMyId PRIMARY KEY, Name CHAR(50)," + "Address CHAR(255)," + "Contact INTEGER));"; cmd = new SqlCommand(sql, conn); cmd.ExecuteNonQuery(); sql = "INSERT INTO mySchoolRecord (StudentId, Name,Address,Contact) VALUES (1, 'Mr. Manish', " + " 'Sector-12,Noida', 2447658 );"; cmd = new SqlCommand(sql, conn); cmd.ExecuteNonQuery(); sql = "INSERT INTO mySchoolRecord (StudentId, Name,Address,Contact) VALUES (2, 'Mr. Ravi', " + " 'New Delhi', 2584076521 );"; cmd = new SqlCommand(sql, conn); cmd.ExecuteNonQuery(); sql = "INSERT INTO mySchoolRecord (StudentId, Name,Address,Contact) VALUES (3, 'Mr. Peter', " + " 'United States', 25684124 );"; cmd = new SqlCommand(sql, conn); cmd.ExecuteNonQuery(); if (conn.State == ConnectionState.Open) { conn.Close(); } } catch (Exception ex) { Console.WriteLine(ex); } } } </code></pre> <p>THANKS SIR</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload