Hi i m new user in vb.net so i want plz u people help mee, i just want to conect my project to sql server database.
joharasad 0 Newbie Poster
Recommended Answers
Jump to PostHere is a code example what MeSampath suggested:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 'Read an image Using conn As New System.Data.SqlClient.SqlConnection("Data Source=apex2006sql;Initial Catalog=Scott;Integrated Security=True;") conn.Open() Using cmd As New SqlClient.SqlCommand("Select Top 1 Name, CreateDate, Picture From Picture", conn) Using dr …
Jump to Postcall globdata.db_update("insert into customer (Name, Phone) VALUES ('name', 'phone')")
You never want to insert values directly in to the command text like that. Use parameterized queries.
Jump to Postplease explain why
There are a lot of reasons
1) Security. When you manually build queries with values in the command text you open your application up for SQL Injection. If you have a query:
Insert Into tbl (Col1, Col2) Values ('a', 'b')
If the values …
All 11 Replies
MeSampath 4 Junior Poster
sknake 1,622 Senior Poster Featured Poster
TomW 73 Posting Whiz
joharasad 0 Newbie Poster
TomW 73 Posting Whiz
jlego 15 Posting Pro
sknake commented: you should consider using parameterized sql -1
sknake 1,622 Senior Poster Featured Poster
jlego 15 Posting Pro
jhpajiri 0 Newbie Poster
jhpajiri 0 Newbie Poster
sknake 1,622 Senior Poster Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.