Click here to Skip to main content
15,898,371 members
Home / Discussions / C#
   

C#

 
GeneralRe: C#/SQL Question--New Problem Pin
Josh Smith7-Jun-06 9:51
Josh Smith7-Jun-06 9:51 
GeneralRe: C#/SQL Question--New Problem Pin
leckey7-Jun-06 9:58
leckey7-Jun-06 9:58 
GeneralRe: C#/SQL Question--New Problem Pin
Josh Smith7-Jun-06 10:12
Josh Smith7-Jun-06 10:12 
GeneralRe: C#/SQL Question--New Problem Pin
leckey7-Jun-06 10:20
leckey7-Jun-06 10:20 
GeneralRe: C#/SQL Question--New Problem Pin
Josh Smith7-Jun-06 10:38
Josh Smith7-Jun-06 10:38 
GeneralRe: C#/SQL Question--New Problem Pin
leckey7-Jun-06 10:44
leckey7-Jun-06 10:44 
GeneralRe: C#/SQL Question--New Problem Pin
Josh Smith7-Jun-06 10:54
Josh Smith7-Jun-06 10:54 
GeneralRe: C#/SQL Question Pin
Colin Angus Mackay7-Jun-06 12:23
Colin Angus Mackay7-Jun-06 12:23 
Continuing from Josh's last comment:

Call BindGrid like this:
BindGrid(cmd, DataGrid1);


private void BindGrid (SqlCommand cmd, System.Web.UI.WebControls.DataGrid DGrid)
{
    // create data adapter
    SqlDataAdapter adapter = new SqlDataAdapter(command);
 
    // create and fill dataset 
    DataSet ds = new DataSet();
    adapter.Fill(ds);
 
    // fill and bind data to Datagrid
    DGrid.DataSource = ds;
    DGrid.DataBind();

    // Close Connection
    conn.Close();
}


All that was done here was the the first two parameters, the connection string and the command string, were replaced with one SqlCommand object.

The call to BindGrid similarly replaces the strings with a SqlCommand object.


"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)

My: Website | Blog
GeneralRe: C#/SQL Question Pin
leckey8-Jun-06 3:32
leckey8-Jun-06 3:32 
GeneralRe: C#/SQL Question Pin
Colin Angus Mackay8-Jun-06 8:28
Colin Angus Mackay8-Jun-06 8:28 
QuestionCalling identically named properties Pin
MartinSmith7-Jun-06 6:24
MartinSmith7-Jun-06 6:24 
AnswerRe: Calling identically named properties Pin
Dustin Metzgar7-Jun-06 6:48
Dustin Metzgar7-Jun-06 6:48 
AnswerRe: Calling identically named properties Pin
Wjousts7-Jun-06 6:52
Wjousts7-Jun-06 6:52 
GeneralRe: Calling identically named properties Pin
MartinSmith7-Jun-06 6:57
MartinSmith7-Jun-06 6:57 
QuestionDesigning HTTP Handler Pin
Raghu Deshpande7-Jun-06 6:14
Raghu Deshpande7-Jun-06 6:14 
QuestionRemoving / Adding HTTP/1.1 headers to HTTPWebRequest object Pin
Raghu Deshpande7-Jun-06 6:12
Raghu Deshpande7-Jun-06 6:12 
QuestionBulk updation thousands of records [modified] Pin
May i help you Munus7-Jun-06 5:49
May i help you Munus7-Jun-06 5:49 
Questionpassing an object Pin
rcwoods7-Jun-06 5:30
rcwoods7-Jun-06 5:30 
AnswerRe: passing an object Pin
User 66587-Jun-06 5:36
User 66587-Jun-06 5:36 
QuestionHandle OK button Pin
Maddie from Dartford7-Jun-06 4:57
Maddie from Dartford7-Jun-06 4:57 
AnswerRe: Handle OK button Pin
Josh Smith7-Jun-06 9:46
Josh Smith7-Jun-06 9:46 
QuestionIs searching in a datagridview possible??? Pin
printscreen123457-Jun-06 4:48
printscreen123457-Jun-06 4:48 
AnswerRe: Is searching in a datagridview possible??? Pin
leckey7-Jun-06 10:31
leckey7-Jun-06 10:31 
QuestionChecking if an event is being handled Pin
Dan Neely7-Jun-06 4:10
Dan Neely7-Jun-06 4:10 
AnswerRe: Checking if an event is being handled Pin
malikjhangirahmed@hotmail.com7-Jun-06 4:38
malikjhangirahmed@hotmail.com7-Jun-06 4:38 

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.