программа для регистрации результатов по экзаменам для школьников

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<img alt="" src="http://social.msdn.microsoft.com/Forums/getfile/289489

<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee Здравствуйте, на фор&#1084;е есть GridView, несколько textbox-ов и кнопка Insert . База в прикрепленно&#1084; файле - состоит из 3-х таблиц
Пред&#1084;еты, Ученики и Экза&#1084;ены <br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee Код C#<br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee private void button1_Click(object sender, EventArgs e)<br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee {<br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee con = new SqlConnection(&quot;Data Source=(local);Initial Catalog=exam;Integrated Security=True&quot;);<br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee con.Open();<br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee str = &quot;Insert into dbo.Exams(dbo.Exams.ID,dbo.Exams.Number,dbo.Exams.Date,dbo.Exams.Mark) <br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee Values (@id,@number,@date,@mark)&quot;;<br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee com = new SqlCommand(str, con);<br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee com.Parameters.AddWithValue(&quot;@id&quot;, subjectTextBox.Text);<br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee com.Parameters.AddWithValue(&quot;@number&quot;, childrenTextBox.Text);<br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee com.Parameters.AddWithValue(&quot;@date&quot;,DateTime.Now);<br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee com.Parameters.AddWithValue(&quot;@mark&quot;, markTextBox.Text);<br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee com.ExecuteNonQuery();<br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee con.Close();<br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee MessageBox.Show(&quot;Record Successfully Inserted&quot;);<br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee }<br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<br style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee не работает, где я ошибся? Нужно добавлять строки в GridView. 
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee
<span style="color:#222222; font-family:Arial,Verdana; font-size:13px; line-height:normal; background-color:#eeeeee <img alt="" src="http://social.msdn.microsoft.com/Forums/getfile/289491

View the full article
 
Back
Top