Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
3
Answers
Dynamic Function using MySql and VB.Net
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
rachayita jaiswal
11y
1.8k
1
Reply
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?
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
Show Messagebox in VB.Net web application
VB.Net with MySql getting error