[dba-VB] A Parameters syntax question

Johncliviger at aol.com Johncliviger at aol.com
Tue Dec 15 04:10:47 CST 2009


 
Hi All
 
I'm connecting a vb2005 DataGridView to an Access db via vb code to  return 
a subset of records from a table. Using the GUID dataType it works fine  
but when I change the datatype I get all the records.
 
I'm using the Imports system.Data.OleDb class. From there I have OleDb  
connection, Command, DataAdapter and a Dataset.
 
EG.
With Command
    .CommandText = "QueryName"
    .CommandType = CommandType.StoredProcedure
    .Connection = OleDbConnection
    .Parameters.Add("@REFNOC", OleDbType.Guid,16).Value  = New Guid(REFNOC)
end With
 
Every thing works as it should. That is until I change the the datatype in  
the Parameter line and try to use a string or Integer.
 
I can't get the syntax right for the .Parameters line. If for example I  
change the .Parameter to say
 .Parameters.Add("@REFNOC", OleDbType.Single).Value = REFNOC I get all  
records
 
Can anyone cast a little light here?




More information about the dba-VB mailing list