jamie_pattison
Well-known member
- Joined
- Sep 9, 2008
- Messages
- 116
- Programming Experience
- Beginner
I am trying to call a View on my database from my .Net code. It works if i type in a Select command instead of the View name but using the View name produces the error "The request for procedure 'SomeView' failed because 'SomeView' is a view object."
My code is
Could anyone help and advise why this is occurring and how to overcome this?
Thanks in advance
My code is
VB.NET:
Dim sqlcon As SqlConnection = New SqlConnection("connection string here")
Dim dv As New DataView
Dim ds As New DataSet
Dim da As New SqlDataAdapter("SomeView", sqlcon)
sqlcon.Open()
da.Fill(ds)
dv = ds.Tables(0).DefaultView
DataGridView1.DataSource = dv
sqlcon.Close()
Could anyone help and advise why this is occurring and how to overcome this?
Thanks in advance