关于服务器连接配置,代码求分析,该如何解决

关于服务器连接配置,代码求分析
void __fastcall TConfigure_Form::Button_TestClick(TObject *Sender)
{
  char tpath[255];
  String spath,tspath,kpath;
  TIniFile *MyInt; //INI文件变量; (为什么需要新建一个INI文件来进行变更)
  if (FileExists("server.INI"))
  //检测有没有INI文件
  {
  GetWindowsDirectory(tpath,255); //获得系统路径
  spath = StrPas(tpath); //char 转换为 String
  tspath = ExtractFilePath(Application->ExeName); //获得当前路径
  kpath = tspath+"\server.INI"; //设置INI文件名
  MyInt = new TIniFile(ChangeFileExt( kpath, ".INI" ) ); //MYINT读取当前文件
   
  MyInt->WriteString("Database","User ID",Edit_User->Text);
  MyInt->WriteString("Database","Password",Edit_Password->Text);
  MyInt->WriteString("Database","Data Source",Edit_Source->Text);
  MyInt->WriteString("Database","Initial Catalog",Edit_Catalog->Text);

  AnsiString str = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=" + Edit_User->Text + ";" + "Password=" + Edit_Password->Text + ";Initial Catalog=" + Edit_Catalog->Text +";Data Source=" + Edit_Source->Text + ";";
  Main_Form->SqlServerConn->Connected=false;
  Main_Form->SqlServerConn->ConnectionString = str;
  try
  {
  Main_Form->SqlServerConn->Connected = true;
  ShowMessage("连接测试成功!");
  }
  catch(Exception *ex)
  {
  MessageBox(NULL,ex->Message.c_str(),"异常对话框",MB_OK);
  }
   
  delete MyInt;
  MyInt = NULL;
  }
  else
  {
  MessageBox(NULL ,"找不文件server.ini 无法进行数据库连接配置!" ,"异常对话框" ,MB_OK);
  } //检测有没有INI文件

}

------解决方案--------------------
做个链接配置方便,不然每次都要你输入服务器地址,用户,密码,数据库
一次还好,如果天天都要手工输入,那肯定烦死了。

另外 TIniFile *MyInt这个是声明一个指向inifile类型的指针而已,并无实际内容。

MyInt = new TIniFile(ChangeFileExt( kpath, ".INI" ) ); 
直到这里才有真正内容。