|
Dim tr As SqlTransaction
tr = sqlconn.BeginTransaction
Try
cmd = new SqlCommand("UPDATE table1 ...")
cmd.Transaction = tr
cmd.ExecuteNonQuery()
cmd = new SqlCommand("Update table2 ...")
cmd.Transaction = tr
cmd.ExecuteNonQuery()
'if you need more than 2 then continue to repeat for
'each command you must execute w/in transaction
tr.Commit()
Begin Catch
tr.Rollback()
'handle exception here
Finally
sqlconn.Close()
End Try
Mark's blog: developMENTALmadness.blogspot.com
Funniest variable name:
lLongDong - spotted in legacy code, was used to determine how long a beep should be. - Dave Bacher
|
|
|
|
|
Hi guys i installed my vs2005 in c drive
and i have my project in d drive
in that project i am doing fileupload concept
i given server mappath to save file:
fileupload1.PostedFile.SaveAs(Server.MapPath("\") & "OnLineResumes\" & filename)
now my quest is
the uploaded file will go and store in c drive or d drive inside the project...,
Means, in which drive it will consider as server mappath?
And see this is my code and its not at all storing the upload file in any of the drive...
I am getting error message as Failed to map the path '/'
See this is my code in button click event:
Dim sqlquery As String = "-"
Dim docid As Integer
sqlquery = "select isnull(max(ResumeId),1000)+1 from tblonlineresume"
sqlcmd = New SqlCommand(sqlquery, sqlconn)
sqlcmd.Connection.Open()
If sqlcmd.ExecuteScalar() > 0 Then
docid = sqlcmd.ExecuteScalar
End If
sqlcmd.Connection.Close()
sqlcmd.Dispose()
Dim filename As String = docid & System.IO.Path.GetFileName(fileupload1.PostedFile.FileName)
strdate = txtdob.Text
If Mid(strdate, 2, 1) = "/" Then strdate = "0" & strdate
If Mid(strdate, 5, 1) = "/" Then strdate = Left(strdate, 3) & "0" & Mid(strdate, 4, 6)
txtdob.Text = Mid(strdate, 4, 3) & Mid(strdate, 1, 2) & Mid(strdate, 6, 5)
Try
sqlcmd = New SqlCommand("submitOnlineResume'" & ddlJob.SelectedValue & "','" & txtName.Text & _
"',' " & txtemail.Text & "','" & txtQualify.Text & "','" & ddlYpass.SelectedValue & "','" & _
Mid(txtdob.Text, 4, 3) & Mid(txtdob.Text, 1, 3) & Mid(txtdob.Text, 7, 4) & "','" & _
ddlfarea.SelectedValue & "','" & ddlAspec.SelectedValue & "','" & txtsset.Text & _
"','" & filename & "'", sqlconn)
sqlcmd.Connection.Open()
sqlcmd.ExecuteScalar()
fileupload1.PostedFile.SaveAs(Server.MapPath("\") & "OnLineResumes\" & filename)
lblMessage.Text = "The file has been uploaded."
sqlcmd.Connection.Close()
sqlcmd.Dispose()
Catch ex As Exception
lblMessage.Text = ex.Message
Finally
End Try
sqlcmd.Connection.Close()
sqlcmd.Dispose()
Thanks & Regards,
NeW OnE,
please don't forget to vote on the post
|
|
|
|
|
Hi,
Test this code: fileupload1.PostedFile.SaveAs(Server.MapPath("~\") & "OnLineResumes\" & filename)
|
|
|
|
|
Hey man its great,
So we have to mention ~ symbol,
Ok but one of my senior did with out that symbol,
but code is same what i have mention before,
So how he can get it?,
whats wrong in my code?
Thanks & Regards,
NeW OnE,
please don't forget to vote on the post
|
|
|
|
|
how to find path of msi which is in Setup
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
Check this out:
http://www.eggheadcafe.com/tutorials/aspnet/2a5222d8-3d69-4f1c-b5ab-35ca33da0f65/net-setup-deployment--m.aspx
If this is no use please post again with more detail on what you want
|
|
|
|
|
hi friend
Thanks for respose
i am using this code in installer class . and when my setup run then it say msi not found Please Help me.
Code:-
Private Sub Installer1_AfterInstall(ByVal sender As Object, ByVal e As System.Configuration.Install.InstallEventArgs) Handles Me.AfterInstall
Dim p As System.Diagnostics.Process
p = System.Diagnostics.Process.Start(Application.StartupPath + "\UccApiSdk.msi")
p.WaitForExit()
End Sub
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
We are implemenmting the MicroSoft Indexing search in our site.our client asked to give provision to search the main folders only, not for SubFolders. So we decided to use the SHALLOW TRAVERSAL OF. But still now we didnt get the correct syntax.
My code:
System.Data.OleDb.OleDbConnection odbSearch = new System.Data.OleDb.OleDbConnection("Provider=\"MSIDXS\";Data Source=\"Agaram\";");
System.Data.OleDb.OleDbCommand cmdSearch = new System.Data.OleDb.OleDbCommand();
cmdSearch.Connection = odbSearch;
odbSearch.Open();
cmdSearch.CommandText = "select Vpath, path, FileName, size, write, attrib, Characterization, DocTitle, rank from scope('' SHALLOW TRAVERSAL OF ("/Software")'') where FREETEXT(contents,'" + searchText + "') order by rank desc ";
System.Data.OleDb.OleDbDataAdapter SqlDa = new System.Data.OleDb.OleDbDataAdapter(cmdSearch);
DataSet Ds = new DataSet();
SqlDa.Fill(Ds);
odbSearch.Close();
/Software is the main folder in my project
The Error is at the Select Query.
Error Details:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1002: ; expected
Source Error:
Line 34: cmdSearch.CommandText = "select Vpath, path, FileName, size, write, attrib, Characterization, DocTitle, rank from scope('' SHALLOW TRAVERSAL OF ("/Software")'') where FREETEXT(contents,'" + searchText + "') order by rank desc ";
|
|
|
|
|
If
Moghan wrote: ("/Software")'') where FREETEXT(contents,'" + searchText + "') order by rank desc ";
is a new line of code then you need to put a + in the line before at the end so that it knows its the end of that line of code
|
|
|
|
|
Thanks for ur reply. Harini's answer working fine.
|
|
|
|
|
Hi
You need to split the string "\Software" as "\"" for each double quotes with escape character:
See below:
cmdSearch.CommandText = "SELECT Vpath, path, FileName, size, write, attrib, Characterization, DocTitle, rank FROM SCOPE('shallow traversal of " + "\"" + "/Software" + "\"" + "') where FREETEXT(contents,'" + searchText + "') order by rank desc ";
Let me know if that works.
Harini
|
|
|
|
|
Hi Harini,
Its working fine now. Thank u vary much. From morning onwards i tried a lot.
|
|
|
|
|
Ok ... That is good!!
Harini
|
|
|
|
|
Hi,
One more thing, replace the variable searchText as parameter to avoid security (SQL Injection).
Harini N K wrote: cmdSearch.CommandText = "SELECT Vpath, path, FileName, size, write, attrib, Characterization, DocTitle, rank FROM SCOPE('shallow traversal of " + "\"" + "/Software" + "\"" + "') where FREETEXT(contents,'" + searchText + "') order by rank desc ";
This is a good coding practice in any langauge.
Harini
|
|
|
|
|
ok.Thanks for ur suggestion
|
|
|
|
|
i write this code:
javascript:window.open('a.html') i want open a.html with small size how can i set the size of my form in my code?
|
|
|
|
|
use something like this:
window.open (this.href, 'popupwindow','width=1000,height=800');return false;"
|
|
|
|
|
thanks for ur help, thats right i write this for:
javascript:window.open('../a.html','_blank','height=200,width=300,menubar=yes');
and thats right but return an object, do u know where should i write return false?
when i write javascript:window.open('../a.html','_blank','height=200,width=300,menubar=yes');return false;
it give an error "return statement outside of function"
|
|
|
|
|
That should work, where is the code, is it in the c#?
|
|
|
|
|
yes its in c#.
exactly its this form:
cell8.Controls.Add(new LiteralControl("<A HREF=" + "javascript:window.open('../a.html','_blank','height=200,width=300,menubar=yes');return false;" + " <span style=" + "font-size:9pt;" + "></span>??? ????? ???</A>"));
and thast error is :return statement outside of function
|
|
|
|
|
|
hey any one can help me in making a list box control as muliple columns.
with this code its looking nasty.
UserList.Items.Add(pcon.dr1(0) & "|" & pcon.dr1(1) & "|" & pcon.dr1(2))
|
|
|
|
|
I was told before I think on this forum that you can't put two columns in a listbox control, I think you can join two different listboxes together but you cant use two columns in one
|
|
|
|
|
www.codeproject.com/KB/webforms/MCEnhancedListBoxControl.aspx
hey in above exapmle i want to assign a datareader to get list box items.
and when transfering like in above page can i transfer datavaluefield ? there i can transfer only selected text only. i want to transfer datavaluefield also can any one suggest.
|
|
|
|
|
I thought it was already taken the datavalue field because it is using lstBox.SelectedItem.Value.ToString();
|
|
|
|
|