Click here to Skip to main content
16,006,440 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: error: index was out of range.must be non-negative....... Pin
Luc Pattyn23-Jan-09 4:21
sitebuilderLuc Pattyn23-Jan-09 4:21 
QuestionYahoo API for YMASS Pin
prabhatmishra23-Jan-09 2:46
prabhatmishra23-Jan-09 2:46 
Questionstop the flow the project Pin
kulandaivel_mca200722-Jan-09 23:08
kulandaivel_mca200722-Jan-09 23:08 
AnswerRe: stop the flow the project Pin
Wendelius22-Jan-09 23:17
mentorWendelius22-Jan-09 23:17 
GeneralRe: stop the flow the project Pin
kulandaivel_mca200722-Jan-09 23:23
kulandaivel_mca200722-Jan-09 23:23 
GeneralRe: stop the flow the project Pin
Wendelius22-Jan-09 23:26
mentorWendelius22-Jan-09 23:26 
GeneralRe: stop the flow the project Pin
kulandaivel_mca200722-Jan-09 23:33
kulandaivel_mca200722-Jan-09 23:33 
GeneralRe: stop the flow the project Pin
Wendelius22-Jan-09 23:43
mentorWendelius22-Jan-09 23:43 
Okay, you could use for example bools:
public bool mthOpenConnection()
{
   try
   {
      string[] datasource = File.ReadAllLines("d:\\k2.txt");
      if (datasource[0] != "")
      {
         objprop.connection = "Data Source=" + datasource[0] + ";Initial Catalog=Inventory_VS;User ID=sa;Password=sa";
         objCon = new SqlConnection(objprop.connection);
         if (objCon.State != ConnectionState.Open)
         {
            objCon.Open();
         }
      }
   }
   catch
   {
      MessageBox.Show("ENTER CORRECT DATA SOURCE NAME IN UR TEXT FILE");
      return false;
   }
   return true;
}

and then
public DataSet mthGetLogin(Properties objproperties)
{
   if (!objDBconnection.mthOpenConnection()) 
   {
      return null;
   }
   SqlDataAdapter objDALogin = new SqlDataAdapter("sp_login", objDBconnection.objCon);
   objDALogin.SelectCommand.Parameters.Add(new SqlParameter("@uname", objproperties.Username));
   objDALogin.SelectCommand.Parameters.Add(new SqlParameter("@pword", objproperties.Password));
   objDALogin.SelectCommand.CommandType = CommandType.StoredProcedure;
   objDALogin.Fill(objDSLogin);
   return objDSLogin;
}


The need to optimize rises from a bad design.My articles[^]

GeneralRe: stop the flow the project Pin
kulandaivel_mca200723-Jan-09 0:07
kulandaivel_mca200723-Jan-09 0:07 
GeneralRe: stop the flow the project Pin
Wendelius23-Jan-09 0:16
mentorWendelius23-Jan-09 0:16 
GeneralRe: stop the flow the project Pin
kulandaivel_mca200723-Jan-09 0:21
kulandaivel_mca200723-Jan-09 0:21 
GeneralRe: stop the flow the project Pin
Wendelius23-Jan-09 0:57
mentorWendelius23-Jan-09 0:57 
GeneralRe: stop the flow the project Pin
kulandaivel_mca200723-Jan-09 0:15
kulandaivel_mca200723-Jan-09 0:15 
GeneralRe: stop the flow the project Pin
Wendelius23-Jan-09 0:18
mentorWendelius23-Jan-09 0:18 
GeneralRe: stop the flow the project Pin
kulandaivel_mca200723-Jan-09 0:22
kulandaivel_mca200723-Jan-09 0:22 
GeneralRe: stop the flow the project Pin
kulandaivel_mca200723-Jan-09 0:57
kulandaivel_mca200723-Jan-09 0:57 
Questionmessage box Pin
vedharadha22-Jan-09 20:14
vedharadha22-Jan-09 20:14 
AnswerRe: message box Pin
VenkatFor.NET22-Jan-09 20:31
VenkatFor.NET22-Jan-09 20:31 
GeneralRe: message box Pin
vedharadha22-Jan-09 20:34
vedharadha22-Jan-09 20:34 
GeneralRe: message box Pin
VenkatFor.NET22-Jan-09 20:46
VenkatFor.NET22-Jan-09 20:46 
AnswerRe: message box Pin
Wendelius22-Jan-09 20:40
mentorWendelius22-Jan-09 20:40 
GeneralRe: message box Pin
vedharadha22-Jan-09 20:52
vedharadha22-Jan-09 20:52 
GeneralRe: message box Pin
VenkatFor.NET22-Jan-09 20:58
VenkatFor.NET22-Jan-09 20:58 
GeneralRe: message box Pin
Wendelius22-Jan-09 21:00
mentorWendelius22-Jan-09 21:00 
GeneralRe: message box Pin
vedharadha22-Jan-09 22:06
vedharadha22-Jan-09 22:06 

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.