Click here to Skip to main content
15,899,474 members
Home / Discussions / C#
   

C#

 
AnswerRe: Exception Pin
valerian.precop10-Jul-07 20:36
valerian.precop10-Jul-07 20:36 
why do you use those two parameters @p1 and @p2 when you can simply do something like this:

string sql = "INSERT INTO tblPassages (column_num, row_num) VALUES ('" + item[0] + "','" + item[1] + "')";
I presume that column_num and row_num are string values in the database.

Usually you use parameters when you use a stored procedure to execute a query.
So you don't need these lines

SqlParameter p1 = new SqlParameter("@p1", item[0]);
SqlParameter p2 = new SqlParameter("@p2", item[1]);
cmd.Parameters.Add(p1);
cmd.Parameters.Add(p2);
p1.SqlDbType = SqlDbType.VarChar;
p2.SqlDbType = SqlDbType.VarChar;


Tell me if it helped... Smile | :)

Just call me Valy... Smile | :)

GeneralRe: Exception Pin
sangramkp10-Jul-07 21:17
sangramkp10-Jul-07 21:17 
GeneralRe: Exception Pin
Brady Kelly10-Jul-07 21:40
Brady Kelly10-Jul-07 21:40 
GeneralRe: Exception Pin
Rhys Gravell10-Jul-07 22:33
professionalRhys Gravell10-Jul-07 22:33 
AnswerRe: Exception Pin
valerian.precop10-Jul-07 21:39
valerian.precop10-Jul-07 21:39 
GeneralRe: Exception Pin
mav.northwind11-Jul-07 8:52
mav.northwind11-Jul-07 8:52 
AnswerRe: Exception Pin
Rhys Gravell10-Jul-07 22:29
professionalRhys Gravell10-Jul-07 22:29 
Questionevent fire Pin
SwaSubhaVijju10-Jul-07 19:20
SwaSubhaVijju10-Jul-07 19:20 
AnswerRe: event fire Pin
_AK_10-Jul-07 19:37
_AK_10-Jul-07 19:37 
AnswerRe: event fire Pin
Vikram A Punathambekar10-Jul-07 19:43
Vikram A Punathambekar10-Jul-07 19:43 
GeneralRe: event fire Pin
SwaSubhaVijju10-Jul-07 19:54
SwaSubhaVijju10-Jul-07 19:54 
AnswerRe: event fire Pin
gauthee10-Jul-07 19:59
gauthee10-Jul-07 19:59 
AnswerRe: event fire Pin
gauthee10-Jul-07 20:04
gauthee10-Jul-07 20:04 
Questiondatagrid Pin
SwaSubhaVijju10-Jul-07 19:03
SwaSubhaVijju10-Jul-07 19:03 
AnswerRe: datagrid Pin
Sathesh Sakthivel10-Jul-07 19:18
Sathesh Sakthivel10-Jul-07 19:18 
GeneralRe: datagrid Pin
SwaSubhaVijju10-Jul-07 19:22
SwaSubhaVijju10-Jul-07 19:22 
GeneralRe: datagrid Pin
Sathesh Sakthivel10-Jul-07 19:26
Sathesh Sakthivel10-Jul-07 19:26 
GeneralRe: datagrid Pin
Steve Echols10-Jul-07 19:28
Steve Echols10-Jul-07 19:28 
AnswerRe: datagrid Pin
Steve Echols10-Jul-07 19:26
Steve Echols10-Jul-07 19:26 
AnswerRe: datagrid Pin
SwaSubhaVijju10-Jul-07 19:53
SwaSubhaVijju10-Jul-07 19:53 
Questionwhile i input "at" to serialport in my program,but return "at" not as excepted "ok"? Pin
supercsharp110-Jul-07 18:46
supercsharp110-Jul-07 18:46 
QuestionMAPI with C# Pin
gihankoli10-Jul-07 18:13
gihankoli10-Jul-07 18:13 
AnswerRe: MAPI with C# Pin
Sathesh Sakthivel10-Jul-07 18:33
Sathesh Sakthivel10-Jul-07 18:33 
QuestionEnum working with string array Pin
saymajum10-Jul-07 16:38
saymajum10-Jul-07 16:38 
AnswerRe: Enum working with string array Pin
PIEBALDconsult10-Jul-07 16:50
mvePIEBALDconsult10-Jul-07 16:50 

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.