oggiii
دوشنبه 16 آذر 1388, 21:12 عصر
سلام بر دوستان برنامه نویس
بچه ها کسی میتونه سورس زیر رو خط به خط توضیح بده و کانکشن ها رو هم تعریف کنه ؟؟
Dim a As New SqlConnection
a.ConnectionString = "Data Source=.;Initial Catalog=amozeshgah;Integrated Security=True;Pooling=False"
Dim b As New SqlCommand
Dim c As New SqlDataAdapter
c.SelectCommand = b
c.SelectCommand.CommandType = CommandType.Text
c.SelectCommand.CommandText = " select * from ostad where
code_ostad=" & "'" & UCase(Trim(TextBox1.Text)) & "'"
c.SelectCommand.Connection = a
Dim d As New DataSet
d.Clear()
c.Fill(d, "OSTAD")
If d.Tables(0).Rows.Count > 0 Then
d.Clear()
c.Fill(d)
MsgBox("این کد پیش از این در بانک اطلاعاتی ذخیره شده است", MsgBoxStyle.OkOnly, "جستجو اطلاعات")
Else
b.Connection = a
b.CommandType = CommandType.Text
b.CommandText = "use amozeshgah insert into ostad values ('" & TextBox1.Text & "','" & TextBox2.Text & "' ,'" & TextBox3.Text & "' ,'" & TextBox4.Text & "' ,'" & TextBox5.Text & "','" & MaskedTextBox1.Text & "','" & TextBox7.Text & "','" & TextBox8.Text & "')"
b.Connection = a
b.Connection.Open()
b.ExecuteNonQuery()
b.Connection.Close()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
MaskedTextBox1.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
MsgBox("اطلاعات با موفقیت ذخیره شد", MsgBoxStyle.OkOnly, "ذخیره اطلاعات")
TextBox1.Focus()
End If
بچه ها کسی میتونه سورس زیر رو خط به خط توضیح بده و کانکشن ها رو هم تعریف کنه ؟؟
Dim a As New SqlConnection
a.ConnectionString = "Data Source=.;Initial Catalog=amozeshgah;Integrated Security=True;Pooling=False"
Dim b As New SqlCommand
Dim c As New SqlDataAdapter
c.SelectCommand = b
c.SelectCommand.CommandType = CommandType.Text
c.SelectCommand.CommandText = " select * from ostad where
code_ostad=" & "'" & UCase(Trim(TextBox1.Text)) & "'"
c.SelectCommand.Connection = a
Dim d As New DataSet
d.Clear()
c.Fill(d, "OSTAD")
If d.Tables(0).Rows.Count > 0 Then
d.Clear()
c.Fill(d)
MsgBox("این کد پیش از این در بانک اطلاعاتی ذخیره شده است", MsgBoxStyle.OkOnly, "جستجو اطلاعات")
Else
b.Connection = a
b.CommandType = CommandType.Text
b.CommandText = "use amozeshgah insert into ostad values ('" & TextBox1.Text & "','" & TextBox2.Text & "' ,'" & TextBox3.Text & "' ,'" & TextBox4.Text & "' ,'" & TextBox5.Text & "','" & MaskedTextBox1.Text & "','" & TextBox7.Text & "','" & TextBox8.Text & "')"
b.Connection = a
b.Connection.Open()
b.ExecuteNonQuery()
b.Connection.Close()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
MaskedTextBox1.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
MsgBox("اطلاعات با موفقیت ذخیره شد", MsgBoxStyle.OkOnly, "ذخیره اطلاعات")
TextBox1.Focus()
End If