Click here to Skip to main content
15,923,142 members
Home / Discussions / Database
   

Database

 
AnswerRe: Error with INSERT INTO Pin
QuietKnight13-Sep-05 11:16
QuietKnight13-Sep-05 11:16 
GeneralRe: Error with INSERT INTO Pin
QuietKnight13-Sep-05 11:18
QuietKnight13-Sep-05 11:18 
Questionabout SQL ... Pin
mostafa_h8-Sep-05 9:25
mostafa_h8-Sep-05 9:25 
AnswerRe: about SQL ... Pin
Colin Angus Mackay8-Sep-05 10:57
Colin Angus Mackay8-Sep-05 10:57 
GeneralRe: about SQL ... Pin
mostafa_h8-Sep-05 15:24
mostafa_h8-Sep-05 15:24 
GeneralRe: about SQL ... Pin
Colin Angus Mackay8-Sep-05 20:08
Colin Angus Mackay8-Sep-05 20:08 
GeneralRe: about SQL ... Pin
mostafa_h14-Sep-05 20:17
mostafa_h14-Sep-05 20:17 
GeneralRe: about SQL ... Pin
Colin Angus Mackay14-Sep-05 20:29
Colin Angus Mackay14-Sep-05 20:29 
I'll repeat my example with greater annotation:

// This is the text of the SQL Command.
// see that variable names start with the @ symbol
string mySearch = "SELECT * "+"FROM MyTable "+
    "WHERE (telephone=@telephone AND @telephone IS NOT NULL) "+
    "OR ((family = @family AND name = @name) AND @telephone IS NULL)";
SqlCommand cmd = SqlCommand(mySearch, myConnection);
 
// This adds the values to the SQL variables.
// These are called parameters.
cmd.Parameters.Add("@telephone", telephoneNumber);
cmd.Parameters.Add("@name", name);
cmd.Parameters.Add("@family", family);
 
// Run the SQL command and get the results.
SqlDataReader reader = cmd.ExecuteReader();
while(reader.Read())
{
    // Do what you need to do with each row from the table.
}



manije wrote:
but instead of using @myVar, I use field name directly and I'd no problem

These are two separate things. I cannot see how that would work without seeing your code. I suspect that there is some confusion with terminology here.


My: Blog | Photos

"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious


GeneralRe: about SQL ... Pin
mostafa_h14-Sep-05 21:19
mostafa_h14-Sep-05 21:19 
GeneralRe: about SQL ... Pin
Colin Angus Mackay15-Sep-05 2:47
Colin Angus Mackay15-Sep-05 2:47 
GeneralRe: about SQL ... Pin
mostafa_h15-Sep-05 3:32
mostafa_h15-Sep-05 3:32 
QuestionDataGrid new row Pin
airbus3808-Sep-05 6:01
airbus3808-Sep-05 6:01 
AnswerRe: DataGrid new row Pin
enjoycrack8-Sep-05 23:51
enjoycrack8-Sep-05 23:51 
AnswerRe: DataGrid new row Pin
miah alom9-Sep-05 5:54
miah alom9-Sep-05 5:54 
QuestionMS Hierarchical FlexGrid Pin
pjhenry12168-Sep-05 5:32
pjhenry12168-Sep-05 5:32 
AnswerRe: MS Hierarchical FlexGrid Pin
smita_roy8-Sep-05 19:59
smita_roy8-Sep-05 19:59 
QuestionT-Sql problem Pin
WDI8-Sep-05 4:55
WDI8-Sep-05 4:55 
AnswerRe: T-Sql problem Pin
Colin Angus Mackay8-Sep-05 10:39
Colin Angus Mackay8-Sep-05 10:39 
GeneralRe: T-Sql problem Pin
Frank Kerrigan9-Sep-05 0:37
Frank Kerrigan9-Sep-05 0:37 
QuestionCall a variable from the another Form ... Pin
mostafa_h7-Sep-05 21:38
mostafa_h7-Sep-05 21:38 
AnswerRe: Call a variable from the another Form ... Pin
enjoycrack8-Sep-05 0:44
enjoycrack8-Sep-05 0:44 
GeneralRe: Call a variable from the another Form ... Pin
mostafa_h8-Sep-05 1:52
mostafa_h8-Sep-05 1:52 
GeneralRe: Call a variable from the another Form ... Pin
enjoycrack8-Sep-05 1:54
enjoycrack8-Sep-05 1:54 
GeneralRe: Call a variable from the another Form ... Pin
mostafa_h8-Sep-05 4:15
mostafa_h8-Sep-05 4:15 
GeneralRe: Call a variable from the another Form ... Pin
enjoycrack8-Sep-05 21:07
enjoycrack8-Sep-05 21:07 

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.