تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] محتاج كود يقوم بإعادة الترقيم
#4
كود :
System.InvalidCastException occurred
 HResult=0x80004002
 Message=Unable to cast object of type 'System.Data.OleDb.OleDbConnection' to type 'System.Data.SqlClient.SqlConnection'.
 Source=autonumber
 StackTrace:
  at autonumber.Form1.Button1_Click(Object sender, EventArgs e) in C:\Users\TheGhost\Documents\Visual Studio 2017\Projects\autonumber\autonumber\Form1.vb:line 7
  at System.Windows.Forms.Control.OnClick(EventArgs e)
  at System.Windows.Forms.Button.OnClick(EventArgs e)
  at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
  at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
  at System.Windows.Forms.Control.WndProc(Message& m)
  at System.Windows.Forms.ButtonBase.WndProc(Message& m)
  at System.Windows.Forms.Button.WndProc(Message& m)
  at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
  at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
  at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
  at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
  at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
  at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
  at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
  at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
  at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
  at autonumber.My.MyApplication.Main(String[] Args) in :line 81


وين الخلل
كود :
Imports System.Data.SqlClient

Public Class Form1
   Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
       Dim s As String = "1"
       Dim a As String = "select isnull(max(Cus_ID),0) from Customer"
       Dim comman As New SqlCommand(a, conn)
       conn.Open()

       Dim readr As SqlDataReader = comman.ExecuteReader
       If readr.Read Then
           s = readr.Item(0) + 1
           TextBox1.Text = s

       End If
       conn.Close()
       readr.Close()
   End Sub
End Class
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
RE: محتاج كود يقوم بإعادة الترقيم - بواسطة 0theghost0 - 26-09-17, 09:36 AM

المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  [مشروع] مشروع لاضافة رسم بيانى محتاج التدخل لاصلاحه dr.programming 0 223 09-11-25, 01:48 AM
آخر رد: dr.programming
  [VB.NET] محتاج اربط DataGridView بزر بحث bakrycold 1 558 28-02-25, 12:11 AM
آخر رد: bakrycold
  محتاج تعديل على كود الحذف new_programer 2 658 17-02-25, 06:50 PM
آخر رد: new_programer
  محتاج كود انتقال خالد كامل1 2 444 22-01-25, 11:38 AM
آخر رد: قناص المدينة
  محتاج عمل التقارير pdf خالد كامل1 3 492 20-01-25, 01:06 AM
آخر رد: خالد كامل1
  [VB.NET] طلب كود vba اكسل يقوم بنسخ خلية من قائمة ثم لصقها في خلية اخرى Faisal_kg 0 374 25-10-24, 09:13 PM
آخر رد: Faisal_kg
  [سؤال] مشكلة محتاج تفسير dr.programming 0 308 28-08-24, 02:43 PM
آخر رد: dr.programming
  محتاج الكود بحث عن اخر فاتورة مبيعات (مستعجل يا اخواني) Hamza8484 2 488 21-08-24, 12:00 AM
آخر رد: ba2e44ca9a
  السلام عليكم - محتاج كود لوحة الارقام في شاشة paid cash Hamza8484 1 405 13-08-24, 10:23 AM
آخر رد: تركي الحلواني
  محتاج مساعدة تعديل اعدادات التقرير في الكريستال ريبورت فاتورة (8) C Hamza8484 2 506 23-07-24, 05:03 AM
آخر رد: Hamza8484

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


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