TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
rachayita jaiswal
NA
217
106.8k
Dynamic Function using MySql and VB.Net
Jul 11 2013 3:29 AM
I have one function -
Public Function GetDataTable(ByVal Query As String) As DataTable
Dim dtConnection As New OdbcConnection(ConfigurationManager.ConnectionStrings("DBConnection").ToString)
dtConnection.Open()
Dim dtTable As New DataTable
Dim da As OdbcDataAdapter
da = New OdbcDataAdapter(Query, dtConnection)
da.Fill(dtTable)
da.Dispose()
dtConnection.Close()
Return dtTable
End Function
i am using this funtion in my code behind file like this -
QryStr = "select * from table where UName='" & txtUserName.Text & "'and pwd='" & txtPassword.Text & "'"
dtUsers = DBClass.GetDataTable(QryStr)
so where ever i want to fetch data from database, i am using this function but here statically i am passing query.
i want to pass stored procedure in place of query so how will i create function with parameters so that i will use that function anywhere in application?
Reply
Answers (
3
)
Printing Invoice
VB.Net with MySql getting error