protected void Button1_Click(object sender, EventArgs e) { level2 obj = new level2 { qno = int.Parse(TextBox1.Text), que = TextBox2.Text, opA = TextBox3.Text, opB = TextBox4.Text, opC = TextBox5.Text, opD = TextBox6.Text, correct = TextBox7.Text }; int res = level2.insert(obj); if (res > 0) { Response.Write("<script>alert(' question is inserted successfully ')</script>"); } else { Response.Write("<script>alert(' question insertion is unsuccessfull ')</script>"); } }
public static int insert(level2 e) { SqlConnection con = Open(); SqlCommand cmd = new SqlCommand(" insert qtabel2 values(@q,@ques,@a,@b,@c,@d,@corr)", con); cmd.Parameters.AddWithValue("@q", e.qno); cmd.Parameters.AddWithValue("@ques", e.que); cmd.Parameters.AddWithValue("@a", e.opA); cmd.Parameters.AddWithValue("@b", e.opB); cmd.Parameters.AddWithValue("@c", e.opC); cmd.Parameters.AddWithValue("@d", e.opD); cmd.Parameters.AddWithValue("@corr", e.correct); int res = cmd.ExecuteNonQuery(); con.Close(); return res; }
//Transform camTrans; //Transform playerTrans; ////Vector3 relPos; ////Vector3 initialCamPos; //Camera cam; //float camH, camW; //Vector3 camCenter; //Bounds b; // Use this for initialization void Start () { DrawLine.lineColor = color; Player.color = color; level2Script = this; terrain = GameObject.Find("terrain"); terrainTrans = terrain.transform; Player.controlOn = false; CueLevels.score.SetActive(false); // textOnTerrain = GameObject.Find("TutorialOnTerrain(Clone)"); //if(textOnTerrain!=null)Destroy(textOnTerrain); if (CueLevels.retrying == false) Instantiate(dialogPrefab); else Instantiate(PreBrickPrefab); }
// initialization private void Start() { ui = FindObjectOfType(typeof(MyUI)) as MyUI; lvl = FindObjectOfType(typeof(level2)) as level2; map = transform.parent.GetComponent <Map>(); GameObject tmp = Instantiate(ballObject, new Vector3(transform.position.x - 2, -94, transform.position.z), Quaternion.identity) as GameObject; ball = tmp.GetComponent <Ball>(); ball.setColor(map.getColor()); GameObject tmp2 = Instantiate(ballObject, new Vector3(30, -117, 0), Quaternion.identity) as GameObject; ballWait = tmp2.GetComponent <Ball>(); ballWait.setColor(map.getColor()); angle = new Vector2(0f, 1f); ui.Display(true); }