-
September 27th, 2013, 02:17 PM
#1
Problems connecting to database
Hi
I want to become a bank , but , This line has errors: da.Fill(ds, "f12")
Where is the problem?
Thank
Code:
Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strsql As String
Dim strcon As String
strcon = "Data Source=.;Integrated Security=True"
Dim con As New SqlConnection(strCon)
con.Open()
strsql = "select * from f12"
Dim da As New SqlDataAdapter(strsql, con)
Dim ds As New DataSet()
da.Fill(ds, "f12")
DataGrid1.DataBindings.Add(New Binding("dataource", da, "f12"))
con.Close()
End Sub
End Class
Last edited by ali 254; September 28th, 2013 at 10:04 AM.
-
September 27th, 2013, 11:28 PM
#2
Re: Problems connecting to database
What is the error and which line are you getting it on?
Always use [code][/code] tags when posting code.
-
September 28th, 2013, 01:21 AM
#3
Re: Problems connecting to database
da.Fill(ds, "f12")
Sounds like the problem. Hover over it, and report back
-
September 28th, 2013, 03:57 AM
#4
Re: Problems connecting to database
Thank
When I run the program
It gives the error:
-
September 28th, 2013, 09:53 AM
#5
Re: Problems connecting to database
so the error is telling you where the problem is and what the problem is. I would suggest that you look up the proper way to use the da.fill statement
Always use [code][/code] tags when posting code.
-
September 30th, 2013, 01:55 AM
#6
Re: Problems connecting to database
What is F12? A Table? A View?
Just as a side note: Naming objects are very important! The object's name should reflect what it does, so that you know where is what and what is what in the future. A name such as F12 is really really bad
-
September 30th, 2013, 10:32 AM
#7
Re: Problems connecting to database
thanks my frinds!
resolved problem, from was conection string
-
September 30th, 2013, 11:30 AM
#8
Re: Problems connecting to database
Glad you got it solved and shared with us! Please mark your thread resolved.
-
October 1st, 2013, 04:23 AM
#9
Re: Problems connecting to database
Last edited by ali 254; October 1st, 2013 at 02:08 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|