منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : مشكلتين فى قواعد البيانات ( عرض البيانات + اللغه العربيه )
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
الصفحات : 1 2


تم الامر معي لكن بالتعديلات التالية:
كود :
Dim con As New SqlConnection("Server=.\sqlexpress;Database=medo;Trusted_Connection=True;")


كود :
Try
            Dim strs As String = "INSERT INTO odo_mota (odo_mot_name) VALUES ('" & TextBox1.Text & "')"
            Dim cm As New SqlCommand(strs, con)
            If con.State = ConnectionState.Closed Then
                con.Open()
            End If
            cm.ExecuteNonQuery()
            If con.State = ConnectionState.Open Then
                con.Close()
            End If
            MsgBox("string saved successfuly", MsgBoxStyle.Information, "Done")


        Catch ex As Exception
            If con.State = ConnectionState.Open Then
                con.Close()
            End If


            MsgBox(ex.Message)
            MsgBox("Erorr")
        End Try




ولعرض ماتم حفظه
كود :
Dim cm As New SqlCommand("select * from odo_mota", con)
        If con.State = ConnectionState.Closed Then
            con.Open()
        End If
        Dim dr As SqlDataReader
        dr = cm.ExecuteReader
        If dr.Read Then
            TextBox2.Text = dr.Item("odo_mot_name")
        End If
الصفحات : 1 2