SqlConnection sqlconn = new SqlConnection("Server=T-YOUNGF1\\SQLEXPRESS;Database=pubs;uid=sa;pwd=*");
SqlDataAdapter sda = new SqlDataAdapter();
SqlCommand sqlcmd = new SqlCommand("select * from test", sqlconn);
sda.SelectCommand = sqlcmd;
DataSet ds = new DataSet();
sda.Fill(ds, "test");
ds.WriteXml("c:/aa.xml");
XmlDocument xdoc = new XmlDocument();
xdoc.LoadXml(ds.GetXml());
xdoc.Save("c:/data11.xml");
25 December, 2008
24 December, 2008
Regular Expression Validator
I need a regular expression that will validate a numeric value with just one digit to the right of the decimal position. For example, 123456789.5
Answer: [0-9]*\.[0-9]^
Answer: [0-9]*\.[0-9]^
Check box value getting in aspx.vb
Dim chkarray As String(), Chkboxes As String
Dim J, iLoop As Integer
Chkboxes = "chkSubjects,chkKET,chkPET,chkPREFCE,chkFCE,chkCAE"
chkarray = Split(Chkboxes, ",")
Dim TutorID As String = "T234"
lblmsg.Text = ""
For J = 0 To chkarray.Length - 1
Dim chk As New CheckBoxList
chk = DirectCast(Me.FindControl(chkarray(J)), CheckBoxList)
For iLoop = 0 To chk.Items.Count - 1
If chk.Items(iLoop).Selected = True Then
Dim qryInsertSubjects As String = "INSERT INTO Subject (ID, Subject) VALUES ('" & TutorID & "','" & chk.Items(iLoop).Value & "')"
lblmsg.Text += qryInsertSubjects + "
"
End If
Next iLoop
Next J
Dim J, iLoop As Integer
Chkboxes = "chkSubjects,chkKET,chkPET,chkPREFCE,chkFCE,chkCAE"
chkarray = Split(Chkboxes, ",")
Dim TutorID As String = "T234"
lblmsg.Text = ""
For J = 0 To chkarray.Length - 1
Dim chk As New CheckBoxList
chk = DirectCast(Me.FindControl(chkarray(J)), CheckBoxList)
For iLoop = 0 To chk.Items.Count - 1
If chk.Items(iLoop).Selected = True Then
Dim qryInsertSubjects As String = "INSERT INTO Subject (ID, Subject) VALUES ('" & TutorID & "','" & chk.Items(iLoop).Value & "')"
lblmsg.Text += qryInsertSubjects + "
"
End If
Next iLoop
Next J
Mail Sending, Asp.Net
Dim Mail As New System.Web.Mail.MailMessage()
Mail.To = txtEmail.Text.Trim()
Mail.From = TxtFrom.Text.Trim()
Dim Msg As New StringBuilder
Msg.Append("You recently requested your password from www.yahoo.com." + vbNewLine + vbNewLine)
Msg.Append("Your password to sign on to www.yahoo.com is '" + Password + "'")
Msg.Append(vbNewLine)
Msg.Append(vbNewLine)
Msg.Append("Sincerely,")
Mail.Subject = "Your Bid Buddies Password"
Mail.Body = Msg.ToString()
SmtpMail.SmtpServer = ConfigurationManager.AppSettings("MailServer")
SmtpMail.Send(Mail)
Mail.To = txtEmail.Text.Trim()
Mail.From = TxtFrom.Text.Trim()
Dim Msg As New StringBuilder
Msg.Append("You recently requested your password from www.yahoo.com." + vbNewLine + vbNewLine)
Msg.Append("Your password to sign on to www.yahoo.com is '" + Password + "'")
Msg.Append(vbNewLine)
Msg.Append(vbNewLine)
Msg.Append("Sincerely,")
Mail.Subject = "Your Bid Buddies Password"
Mail.Body = Msg.ToString()
SmtpMail.SmtpServer = ConfigurationManager.AppSettings("MailServer")
SmtpMail.Send(Mail)
highlight text when text box field has focus
The following code is exact correct code
TextBox1.Attributes.Add("onFocus", "JavaScript:this.select();");
for additional
TextBox1.Attributes.Add("onFocus", "JavaScript:this.select();");
for additional
On page load event
TextBox1.Attributes.Add("onfocus", "javascript:return Highlight('" + TextBox1.ClientID + "');");
TextBox1.Attributes.Add("onblur", "javascript:return DeHighlight('" + TextBox1.ClientID + "');");
<script type="text/javascript" language="javascript">
function Highlight(control)
{
var mycontrol = document.getElementById(control);
mycontrol.className = 'Welcome';
}
function DeHighlight(control)
{
var mycontrol = document.getElementById(control);
mycontrol.className = 'Bye';
}