Click here to Skip to main content
15,911,646 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: How Do I detect a video card in a splash screen Pin
Dave Kreskowiak27-Jan-09 4:24
mveDave Kreskowiak27-Jan-09 4:24 
GeneralRe: How Do I detect a video card in a splash screen Pin
rspercy6527-Jan-09 10:33
rspercy6527-Jan-09 10:33 
QuestionOther problem with Parameters in Select statement Pin
ivo7526-Jan-09 7:47
ivo7526-Jan-09 7:47 
AnswerRe: Other problem with Parameters in Select statement Pin
Jon_Boy26-Jan-09 8:07
Jon_Boy26-Jan-09 8:07 
GeneralRe: Other problem with Parameters in Select statement Pin
ivo7526-Jan-09 8:19
ivo7526-Jan-09 8:19 
GeneralRe: Other problem with Parameters in Select statement Pin
Dave Kreskowiak26-Jan-09 11:38
mveDave Kreskowiak26-Jan-09 11:38 
AnswerRe: Other problem with Parameters in Select statement Pin
Jon_Boy26-Jan-09 9:07
Jon_Boy26-Jan-09 9:07 
AnswerRe: Other problem with Parameters in Select statement Pin
Wendelius26-Jan-09 18:36
mentorWendelius26-Jan-09 18:36 
Few comments:
- when doing select, don't use ExecuteNonQuery. Use for example ExecuteReader. However, since you later use adapter.fill you dont't need to execute anything at that point
- when assigning values to the parameters, don't modify their datatype unless the datatype in database is different. So instead of param2.Value = DateTimePicker1.Value.ToShortDateString use param2.Value = DateTimePicker1.Value
- also you created a new command and used it instead of the command where you added the parameters

So your code could be something like:
...
strQuery = "Select * from rabotnici where rabotnik_name=? and data_rabota>=? and data_rabota<=?"
param1 = New OleDbParameter("@rabotnik_name", OleDbType.VarWChar, 100)
param1.Value = ComboBox1.Text
param2 = New OleDbParameter("@data_rabota", OleDbType.Date)
param2.Value = DateTimePicker1.Value
param3 = New OleDbParameter("@data_rabota1", OleDbType.Date)
param3.Value = DateTimePicker2.Value
aCmd = New OleDbCommand(strQuery, aCon)
aCmd.Parameters.Add(param1)
aCmd.Parameters.Add(param2)
aCmd.Parameters.Add(param3)

Dim da As New OleDbDataAdapter
da.SelectCommand = aCmd
Dim ds As DataSet
ds = New DataSet("Customers1")
da.Fill(ds, "New Customers1")
...


The need to optimize rises from a bad design.My articles[^]

QuestionUse of Private Properties Pin
Jay Royall26-Jan-09 4:27
Jay Royall26-Jan-09 4:27 
AnswerRe: Use of Private Properties Pin
Wendelius26-Jan-09 5:23
mentorWendelius26-Jan-09 5:23 
GeneralRe: Use of Private Properties Pin
Jay Royall26-Jan-09 5:40
Jay Royall26-Jan-09 5:40 
GeneralRe: Use of Private Properties Pin
Wendelius26-Jan-09 6:06
mentorWendelius26-Jan-09 6:06 
AnswerRe: Use of Private Properties Pin
Jon_Boy26-Jan-09 7:55
Jon_Boy26-Jan-09 7:55 
GeneralRe: Use of Private Properties Pin
Jay Royall26-Jan-09 21:55
Jay Royall26-Jan-09 21:55 
GeneralRe: Use of Private Properties Pin
Dave Kreskowiak27-Jan-09 1:35
mveDave Kreskowiak27-Jan-09 1:35 
GeneralRe: Use of Private Properties Pin
Jon_Boy27-Jan-09 2:23
Jon_Boy27-Jan-09 2:23 
QuestionWebBrowser control Pin
Stephen Lintott26-Jan-09 0:25
Stephen Lintott26-Jan-09 0:25 
AnswerRe: WebBrowser control Pin
Manas Bhardwaj26-Jan-09 1:03
professionalManas Bhardwaj26-Jan-09 1:03 
GeneralRe: WebBrowser control Pin
Stephen Lintott26-Jan-09 1:24
Stephen Lintott26-Jan-09 1:24 
AnswerRe: WebBrowser control Pin
EliottA26-Jan-09 2:59
EliottA26-Jan-09 2:59 
Questionadd an ID from an from an combobox in buttun click event Pin
Qendro25-Jan-09 12:01
Qendro25-Jan-09 12:01 
AnswerRe: add an ID from an from an combobox in buttun click event Pin
Steven J Jowett25-Jan-09 23:16
Steven J Jowett25-Jan-09 23:16 
GeneralRe: add an ID from an from an combobox in buttun click event Pin
Qendro25-Jan-09 23:39
Qendro25-Jan-09 23:39 
GeneralRe: add an ID from an from an combobox in buttun click event Pin
Christian Graus26-Jan-09 0:23
protectorChristian Graus26-Jan-09 0:23 
Question[Message Deleted] Pin
IvanIT25-Jan-09 10:45
IvanIT25-Jan-09 10:45 

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.