-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Kashypa78
Message 5 in Discussion


Hi 
Anjali 
 
Try this one.
 
StringBuilder strInsert = new 
StringBuilder();
strInsert.AppendFormat("Insert Into 
emp")

strInsert.AppendFormat("(")

strInsert.AppendFormat("    
username,")

strInsert.AppendFormat("    
password,")

strInsert.AppendFormat("    
firstname,")

strInsert.AppendFormat("    secondname 
")

strInsert.AppendFormat(")")

strInsert.AppendFormat("values 
")

strInsert.AppendFormat("(")

strInsert.AppendFormat("    
'{0}',",txtUserName.text)

strInsert.AppendFormat("    '{0}',", 
txtPassword.text")

strInsert.AppendFormat("    '{0}',", 
txtFirstName.text")

strInsert.AppendFormat("    '{0}' ", 
txtUserName")

strInsert.AppendFormat(")")
 
then call the strInsert.ToString() to get it as 
string
 
regards
Lohith
Aztec Software
Blore
9845304023   

 
strInsert= 
string.format("insert into emp(username,password,firstname,secondname) 
values('{0}','{1}','{2}','{3}')",txtusername.text,txtpassword.text,txtfirstname.text,txtsecondname.text)

  -----Original Message-----
From: Anjali_Mehta_DotNet 
  [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 30, 2004 2:50 
  AM
To: dotNET User Group Hyd
Cc: AhmedabadUserGroup; 
  PuneUserGroup; DOTNETSIG; kolkatanet; [EMAIL PROTECTED]; MS 
  Dot Net Indore; BDOTNET; [EMAIL PROTECTED]; Chennai .NET User Group; 
  MumbaiUserGroup
Subject: String formatting 
  help


  
    
      
      New Message on BDOTNET
    
      

  String 
    formatting help


    
      
      
        Reply

        
          
            
            
               
              Reply to Sender   Recommend 
              Message 1 in 
                Discussion 
      
        
          
            
            
              From: Anjali_Mehta_DotNet 
              
            
              

                May sound silly,  i have a 
                silly test program that add a record in db ..input is from 
                webform
                iam using string.format to create 
                my Sql string, it works fine, what i want to put this sql string 
                in multiple lines, currently whole string is in one line, please 
                some one..
                 
                Guys dont get bored with my stuff, 
                just started doing .NET .. i guess these are starting glithces 
                that everybody experiences.
                 
                 
                dim con as 
                sqlconnection
     dim cmdInsert as 
                sqlcommand
     dim strInsert as 
                string
                 
                     con = new 
                sqlconnection("server=localhost;uid=sa;pwd=*****;database=*******")
     
                con.open()
     
                 
                
strInsert= string.format("insert into 
                emp(username,password,firstname,secondname) 
                
values('{0}','{1}','{2}','{3}')",txtusername.text,txtpassword.text,txtfirstname.text,txtsecondname.text)
                 
                cmdInsert= new 
                sqlcommand(strInsert,con)
cmdInsert.ExecuteNonquery()
con.close()
                 
                 
                 
                Anjali 
      Mehta

View other groups in this 
    category. 



-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to