الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

no constructor problem

بدأه mmsalman87 في 14 يونيو 2010 · 1 رد · 376 مشاهدة · في ADO.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

Imports System.Data.SqlClient

Public Class Form1

Dim myConnection As SqlConnection

Dim myCommand As SqlCommand

Dim dr As New SqlDataReader()

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

myConnection = New SqlConnection("Data Source=192.168.0.1;Initial Catalog=gp;User Id=ga;Password=gg")

'establishing connection. you need to provide password for sql server

'Try

myConnection.Open()

'opening the connection

myCommand = New SqlCommand("SELECT rec FROM MASTER WHERE no = '123456'", myConnection)

'executing the command and assigning it to connection

dr = myCommand.ExecuteReader()

While dr.Read()

'reading from the datareader

MessageBox.Show("rec" & dr(0).ToString())

'displaying the data from the table

End While

dr.Close()

myConnection.Close()

'Catch e As Exception

' End Try

End Sub

End Class

عند التنفيذ بيعطيني الخطا التالي :

Type 'System.Data.SqlClient.SqlDataReader' has no constructors

Maher Salman

Senior Oracle Developer

Oracle Certified Professional

Kuwait

اللهم إني أعوذ بك من الهم والغم والحزن،

وأعوذ بك من العجز والكسل والفشل،

وأعوذ بك من الجبن والبخل،

وأعوذ بك من الكفر والفقر،

وأعوذ بك من غلبة الدين وقهر الرجال

#2

بسم الله الرحمن الرحيم

اخى العزيز

حول من

Dim dr As New SqlDataReader()

الى

Dim dr As SqlDataReader()

مواضيع مشابهة