تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
هل من حل لمشكلتي
#6
(06-07-21, 01:08 AM)خالد20 كتب : شكرا على ردك ولكن هناك مشكلة هناك تغييرات نضطر لعملها في قاعدة البيانات في النسخ المحدثة
هذه التغييرات هي انشاء جداول جديدة واكواد جديدة وتعدل على اكواد قديمة واضافة حقول اضافية لبعض الجداول

طيب بعيدا عن الاستيراد والتصدير
ليش ما تضيف اوتعدل في جدول في نفس  القاعدة التي مع الزبون  بالكود
تعمل له شرط اذا كان الجودل موجود لاتفعل شيء
واذا كان غير موجود اضفه

شي مقارب لهذا


كود :
   Option Strict On
   Option Explicit On
   
   Imports System.Data.SqlClient
   
   Public Class MyForm
       Private Sub MyForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
           Dim conn As New SqlConnection()  'Creates a new connection object
           Dim cmd As New SqlCommand()      'Creates a new command object
   
           Dim exists As Byte = 0           'Creates a byte variable that will store the cmd return value
   
           conn.ConnectionString = "Data Source=MyServer; " & _
                                   "Initial Catalog=MyDatabase; " & _
                                   "User Id=MyUserId; " & _
                                   "Password=MyPassword"
   
           cmd.CommandText = "SELECT COUNT(*) " & _
                              "FROM sys.objects " & _
                              "WHERE object_id = OBJECT_ID(N'[dbo].[TableName]') " & _
                              "AND type in (N'U')"
   
           Try
               conn.Open()                             'Opens the connection
               cmd.Connection = conn                   'Instructs the cmd object to use conn as its connection when executing
               exists = CByte(cmd.ExecuteScalar())     'Use ExecuteScalar to return a single value, the count, and assign it to the exists variable
               conn.Close()
           Catch ex As SqlException
               MessageBox.Show(ex.Message)             'Catch any SqlException and display it in a MessageBox
           Catch ex As Exception
               MessageBox.Show(ex.Message)             'Catch any ApplicationException and display it in a MessageBox
           End Try
   
           MyButton.Enabled = CBool(exists)            'Convert the exists variable to a boolean to determine whether the button should be enabled.
   
           'Note that by assigning the exists variable a value of 0 earlier, if there is an error in connecting to the database, the value will
           'remain 0, and the button will be disabled by default.  
   
       End Sub
   End Class
الرد }}}
تم الشكر بواسطة: mmaalmesry , ابراهيم ايبو


الردود في هذا الموضوع
هل من حل لمشكلتي - بواسطة خالد20 - 05-07-21, 01:28 PM
RE: هل من حل لمشكلتي - بواسطة Jounior_P - 06-07-21, 12:35 AM
RE: هل من حل لمشكلتي - بواسطة خالد20 - 06-07-21, 01:08 AM
RE: هل من حل لمشكلتي - بواسطة asemshahen5 - 06-07-21, 09:08 AM
RE: هل من حل لمشكلتي - بواسطة خالد20 - 06-07-21, 11:29 AM
RE: هل من حل لمشكلتي - بواسطة alfaiz678 - 06-07-21, 12:29 PM
RE: هل من حل لمشكلتي - بواسطة kebboud - 06-07-21, 12:58 PM
RE: هل من حل لمشكلتي - بواسطة خالد20 - 06-07-21, 03:35 PM
RE: هل من حل لمشكلتي - بواسطة خالد20 - 08-07-21, 10:20 AM

المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  ممكن حل لمشكلتي tofe90 3 2,732 04-09-18, 01:46 AM
آخر رد: elgokr
  اريد حل لمشكلتي في برنامجي الاول awadhabdullah 5 3,194 09-02-14, 11:34 PM
آخر رد: awadhabdullah

التنقل السريع :


يقوم بقرائة الموضوع: