Click here to Skip to main content
15,909,051 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Compare the structure for 2 sql server databases Pin
Eddy Vluggen10-Apr-15 10:10
professionalEddy Vluggen10-Apr-15 10:10 
GeneralRe: Compare the structure for 2 sql server databases Pin
dilkonika10-Apr-15 10:16
dilkonika10-Apr-15 10:16 
GeneralRe: Compare the structure for 2 sql server databases Pin
Eddy Vluggen10-Apr-15 10:27
professionalEddy Vluggen10-Apr-15 10:27 
GeneralRe: Compare the structure for 2 sql server databases Pin
dilkonika10-Apr-15 12:35
dilkonika10-Apr-15 12:35 
GeneralRe: Compare the structure for 2 sql server databases Pin
Eddy Vluggen11-Apr-15 8:49
professionalEddy Vluggen11-Apr-15 8:49 
Questionvb.net 2010 pass value to function Pin
dcof9-Apr-15 13:04
dcof9-Apr-15 13:04 
AnswerRe: vb.net 2010 pass value to function Pin
Richard MacCutchan9-Apr-15 21:53
mveRichard MacCutchan9-Apr-15 21:53 
AnswerRe: vb.net 2010 pass value to function Pin
Richard Deeming10-Apr-15 3:39
mveRichard Deeming10-Apr-15 3:39 
Don't use string concatenation to pass the parameter - you'll leave your code vulnerable to SQL Injection[^].

Instead, pass the parameter in the Parameters collection, in the same way as the Letter.Link parameter:
VB.NET
Const sql As String = "SELECT d.LINK,d.absdt  " _
   & ",CAST(ROUND(SUM([ABSCNT]), 2) AS NUMERIC(24,2)) AS absentCount " _
   & "FROM ADetails d INNER JOIN AASTU s ON d.link = s.link  " _
   & "INNER JOIN AASCH sch ON d.schoolnum = sch.schoolnum  " _
   & "WHERE d.STULINK = @link " _                         
   & "AND d.schoolnum = @SchoolNum " _
   & "GROUP BY d.LINK,d.absdt  " _
   & "ORDER BY d.ABSDT ; "

Using con As SqlConnection = DB.OpenConnectionS()
   Using da As SqlDataAdapter = New SqlDataAdapter(sql, con)
      da.SelectCommand.Parameters.Add("@link", SqlDbType.Int).Value = Letter.Link  
      da.SelectCommand.Parameters.AddWithValue("@SchoolNum", SchoolNum)
      da.Fill(_dt)
   End Using
End Using
You should also remove the Try..Catch block, which is swallowing the exception, making it virtually impossible to debug the error.



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


GeneralRe: vb.net 2010 pass value to function Pin
dcof10-Apr-15 4:12
dcof10-Apr-15 4:12 
QuestionVB6 TextBox truncates text in IE 11 Compatibility Mode Pin
Bill Cumming9-Apr-15 5:29
Bill Cumming9-Apr-15 5:29 
QuestionRe: VB6 TextBox truncates text in IE 11 Compatibility Mode Pin
Richard Deeming9-Apr-15 7:08
mveRichard Deeming9-Apr-15 7:08 
AnswerRe: VB6 TextBox truncates text in IE 11 Compatibility Mode Pin
Bill Cumming9-Apr-15 7:15
Bill Cumming9-Apr-15 7:15 
QuestionWM that has to do with pressing the enter key and TAB key. Pin
dilkonika8-Apr-15 13:29
dilkonika8-Apr-15 13:29 
AnswerRe: WM that has to do with pressing the enter key and TAB key. Pin
CHill608-Apr-15 13:44
mveCHill608-Apr-15 13:44 
GeneralRe: WM that has to do with pressing the enter key and TAB key. Pin
dilkonika8-Apr-15 13:48
dilkonika8-Apr-15 13:48 
GeneralRe: WM that has to do with pressing the enter key and TAB key. Pin
CHill608-Apr-15 13:58
mveCHill608-Apr-15 13:58 
GeneralRe: WM that has to do with pressing the enter key and TAB key. Pin
dilkonika8-Apr-15 15:35
dilkonika8-Apr-15 15:35 
GeneralRe: WM that has to do with pressing the enter key and TAB key. Pin
CHill608-Apr-15 23:41
mveCHill608-Apr-15 23:41 
GeneralRe: WM that has to do with pressing the enter key and TAB key. Pin
dilkonika9-Apr-15 6:34
dilkonika9-Apr-15 6:34 
GeneralRe: WM that has to do with pressing the enter key and TAB key. Pin
dilkonika9-Apr-15 7:21
dilkonika9-Apr-15 7:21 
GeneralRe: WM that has to do with pressing the enter key and TAB key. Pin
CHill609-Apr-15 10:49
mveCHill609-Apr-15 10:49 
QuestionSelectedPath Property Pin
JKarov7-Apr-15 4:39
JKarov7-Apr-15 4:39 
AnswerRe: SelectedPath Property Pin
Richard Andrew x647-Apr-15 5:12
professionalRichard Andrew x647-Apr-15 5:12 
GeneralRe: SelectedPath Property Pin
JKarov7-Apr-15 5:15
JKarov7-Apr-15 5:15 
QuestionRe: SelectedPath Property Pin
Richard MacCutchan7-Apr-15 5:58
mveRichard MacCutchan7-Apr-15 5:58 

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.