Click here to Skip to main content
15,912,977 members
Home / Discussions / Database
   

Database

 
GeneralRe: T-SQL Problem Pin
Colin Angus Mackay5-Jul-05 7:27
Colin Angus Mackay5-Jul-05 7:27 
GeneralRe: T-SQL Problem Pin
WDI5-Jul-05 8:07
WDI5-Jul-05 8:07 
GeneralFill DataSet with nothing Pin
SebbaP5-Jul-05 4:45
SebbaP5-Jul-05 4:45 
GeneralRe: Fill DataSet with nothing Pin
Colin Angus Mackay5-Jul-05 5:06
Colin Angus Mackay5-Jul-05 5:06 
GeneralRe: Fill DataSet with nothing Pin
Scott Serl5-Jul-05 12:23
Scott Serl5-Jul-05 12:23 
GeneralRe: Fill DataSet with nothing Pin
SebbaP5-Jul-05 19:59
SebbaP5-Jul-05 19:59 
GeneralRe: Fill DataSet with nothing Pin
Scott Serl6-Jul-05 8:51
Scott Serl6-Jul-05 8:51 
GeneralMS Access and multiple statements on the same connection Pin
SebbaP4-Jul-05 23:02
SebbaP4-Jul-05 23:02 
GeneralRe: MS Access and multiple statements on the same connection Pin
WDI5-Jul-05 6:58
WDI5-Jul-05 6:58 
GeneralRe: MS Access and multiple statements on the same connection Pin
SebbaP5-Jul-05 19:43
SebbaP5-Jul-05 19:43 
Generalconnecting to a database from a stored procedure Pin
Member 4472174-Jul-05 22:11
Member 4472174-Jul-05 22:11 
GeneralRe: connecting to a database from a stored procedure Pin
Colin Angus Mackay4-Jul-05 22:50
Colin Angus Mackay4-Jul-05 22:50 
GeneralI want to change the owner of the object............. Pin
under28114-Jul-05 19:05
under28114-Jul-05 19:05 
GeneralRe: I want to change the owner of the object............. Pin
Christian Graus4-Jul-05 19:19
protectorChristian Graus4-Jul-05 19:19 
GeneralRe: I want to change the owner of the object............. Pin
under28114-Jul-05 19:41
under28114-Jul-05 19:41 
GeneralRe: I want to change the owner of the object............. Pin
Christian Graus4-Jul-05 19:46
protectorChristian Graus4-Jul-05 19:46 
GeneralRe: I want to change the owner of the object............. Pin
Scott Serl5-Jul-05 12:38
Scott Serl5-Jul-05 12:38 
Generalsd Pin
Anonymous4-Jul-05 18:56
Anonymous4-Jul-05 18:56 
QuestionHow to optimise performance of retrieving multiple sql function results from DB Pin
luckyeagle4-Jul-05 12:50
luckyeagle4-Jul-05 12:50 
AnswerRe: How to optimise performance of retrieving multiple sql function results from DB Pin
Rob Graham4-Jul-05 13:14
Rob Graham4-Jul-05 13:14 
GeneralRe: How to optimise performance of retrieving multiple sql function results from DB Pin
luckyeagle4-Jul-05 14:43
luckyeagle4-Jul-05 14:43 
GeneralRe: How to optimise performance of retrieving multiple sql function results from DB Pin
Rob Graham5-Jul-05 5:56
Rob Graham5-Jul-05 5:56 
GeneralT-QL Problem Pin
WDI4-Jul-05 10:38
WDI4-Jul-05 10:38 
GeneralRe: T-QL Problem Pin
Colin Angus Mackay4-Jul-05 11:32
Colin Angus Mackay4-Jul-05 11:32 
GeneralRe: T-QL Problem Pin
WDI4-Jul-05 21:05
WDI4-Jul-05 21:05 
I do waht you told but get

Syntax error (missing operator) in query expression 'AND( styleID = @styleID )'.


my method is :

public static IDataReader GetFilteredProduct( FilterEN filterEN )
{
OleDbConnection oleDbConnection;

OleDbCommand oleDbCommand = new OleDbCommand();

OleDbDataReader oleDbDataReader = null;

oleDbCommand.CommandText = "select Product.productID , Product.productName ,
Product.productInfo , Product.productPrice ,
Product.dateOfInsert , Product.status ,
Product.artistID , Artist.artistName from Product
inner join Artist on Product.artistID =
Artist.artistID ";

oleDbConnection = new OleDbConnection (ConfigurationSettings.AppSettings["DbC"]);
try
{
oleDbConnection.Open();

string boolian = ( filterEN.Boolian == 1 ? "OR" : "AND" );

if ( filterEN.StyleID > 0 || filterEN.ArtistID > 0 )

{
oleDbCommand.CommandText += " where ";
}
if ( filterEN.StyleID > 0 )
{
oleDbCommand.CommandText += boolian + "( styleID = @styleID )";

OleDbParameter paramStyleID = new OleDbParameter ( "@styleID" ,
OleDbType.Integer );
paramStyleID.Value = filterEN.StyleID;

oleDbCommand.Parameters.Add ( paramStyleID );

}
if ( filterEN.ArtistID > 0 )
{
oleDbCommand.CommandText += boolian + "artistID = @artistID ";

OleDbParameter paramArtistID = new OleDbParameter ( "@artistID" ,
OleDbType.Integer );
paramArtistID.Value = filterEN.ArtistID;

oleDbCommand.Parameters.Add ( paramArtistID );

}


oleDbCommand.Connection = oleDbConnection;

oleDbDataReader = oleDbCommand.ExecuteReader(CommandBehavior.CloseConnection);
}
catch( Exception ex)
{
throw ex;
}

return oleDbDataReader;
}

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.