Click here to Skip to main content
15,867,771 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionExcel view to datagridview migration Pin
Member 476123426-May-16 20:37
Member 476123426-May-16 20:37 
AnswerRe: Excel view to datagridview migration Pin
Richard MacCutchan26-May-16 21:18
mveRichard MacCutchan26-May-16 21:18 
GeneralRe: Excel view to datagridview migration Pin
Member 476123426-May-16 22:19
Member 476123426-May-16 22:19 
GeneralRe: Excel view to datagridview migration Pin
Member 476123426-May-16 22:19
Member 476123426-May-16 22:19 
GeneralRe: Excel view to datagridview migration Pin
Richard MacCutchan26-May-16 22:52
mveRichard MacCutchan26-May-16 22:52 
QuestionWHERE clause of SELECT command Pin
Raabi Anony25-May-16 21:11
Raabi Anony25-May-16 21:11 
AnswerRe: WHERE clause of SELECT command Pin
Raabi Anony25-May-16 21:19
Raabi Anony25-May-16 21:19 
GeneralRe: WHERE clause of SELECT command Pin
Richard Deeming26-May-16 2:03
mveRichard Deeming26-May-16 2:03 
Your code is vulnerable to SQL Injection[^]. NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.

Everything you wanted to know about SQL injection (but were afraid to ask) | Troy Hunt[^]
How can I explain SQL injection without technical jargon? | Information Security Stack Exchange[^]
Query Parameterization Cheat Sheet | OWASP[^]

VB.NET
Private Function GetDataSource(strCampusName) As DataTable
    Dim conxnString As String = "Data Source=Raabi\SQLEXPRESS;Initial Catalog=StaffReport; Integrated Security=True"
    Dim cmdText As String = "SELECT * from tblStaffInfo tbl WHERE tbl.CampusName = @CampusName"
    
    Using conxn As New SqlConnection(conxnString)
        Using cmd As New SqlCommand(cmdText, conxn)
            cmd.Parameters.AddWithValue("@CampusName", strCampusName)
            
            Dim DGVadapter As New SqlDataAdapter(cmd)
            Dim ds As New DataSet()
            DGVadapter.Fill(ds)
            Return ds.Tables(0)
        End Using
    End Using
End Function




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


QuestionHow to populate data in combobox gridview in VB.net? Pin
kishore-201625-May-16 11:32
kishore-201625-May-16 11:32 
AnswerRe: How to populate data in combobox gridview in VB.net? Pin
Richard MacCutchan25-May-16 21:03
mveRichard MacCutchan25-May-16 21:03 
GeneralRe: How to populate data in combobox gridview in VB.net? Pin
kishore-20165-Jun-16 10:20
kishore-20165-Jun-16 10:20 
GeneralRe: How to populate data in combobox gridview in VB.net? Pin
Richard MacCutchan5-Jun-16 21:24
mveRichard MacCutchan5-Jun-16 21:24 
QuestionDGV with multiple Tables Pin
Raabi Anony23-May-16 17:41
Raabi Anony23-May-16 17:41 
AnswerRe: DGV with multiple Tables Pin
Mycroft Holmes23-May-16 19:53
professionalMycroft Holmes23-May-16 19:53 
SuggestionRe: DGV with multiple Tables Pin
Richard Deeming24-May-16 1:34
mveRichard Deeming24-May-16 1:34 
GeneralRe: DGV with multiple Tables Pin
Mycroft Holmes24-May-16 12:38
professionalMycroft Holmes24-May-16 12:38 
AnswerRe: DGV with multiple Tables Pin
Richard Deeming24-May-16 1:41
mveRichard Deeming24-May-16 1:41 
GeneralRe: DGV with multiple Tables Pin
Raabi Anony24-May-16 16:06
Raabi Anony24-May-16 16:06 
GeneralRe: DGV with multiple Tables Pin
Raabi Anony25-May-16 0:41
Raabi Anony25-May-16 0:41 
GeneralRe: DGV with multiple Tables Pin
Richard Deeming25-May-16 0:55
mveRichard Deeming25-May-16 0:55 
QuestionString or Binary Data Would be Truncated. The Statement has been Terminated Pin
kishore-201622-May-16 7:35
kishore-201622-May-16 7:35 
AnswerRe: String or Binary Data Would be Truncated. The Statement has been Terminated Pin
Sascha Lefèvre22-May-16 12:19
professionalSascha Lefèvre22-May-16 12:19 
QuestionRe: String or Binary Data Would be Truncated. The Statement has been Terminated Pin
Richard MacCutchan22-May-16 21:05
mveRichard MacCutchan22-May-16 21:05 
SuggestionRe: String or Binary Data Would be Truncated. The Statement has been Terminated Pin
Richard Deeming23-May-16 1:52
mveRichard Deeming23-May-16 1:52 
AnswerRe: String or Binary Data Would be Truncated. The Statement has been Terminated Pin
Member 1256155913-Jun-16 5:23
Member 1256155913-Jun-16 5:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.