|
I don't remember the Oracle syntax for it, but the major RDBMSes usually an auto-increment or identity field of some sort. If you use that for the ID, the database will automatically generate a new value when the record is inserted.
Failing that, a few alternatives:
1) Put it all in one DB transaction using a temporary variable. That means get the next index and insert the new record as one combined operation, so nothing can happen in between.
OR
2) Create a stored procedure on the database that inserts the record and returns the ID (If you need to know the ID). Again, keep the entire operation on the database side.
OR
3) If you must do it all on the client side, catch the exception, wait a random number of seconds or milliseconds, and repeat the operation (Checking for the next ID again). This solution is less than optimal, but it's commonly used in certain network protocols.
|
|
|
|
|
If you're using Oracle, look at harnessing the power of a Sequence. This will give you a value that you can use for your primary keys.
Usually you have one sequence per table that needs a numeric primary key.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
I am using a rowfilter with a dataview. How can I ascertain the number of rows which are being displayed please?
|
|
|
|
|
You can use
dataview's rowfilter property="select top 10 "
This might work fine
Thank You
Vinod(vinod8812@gmail.com)
|
|
|
|
|
|
I used DisplayedRowCount() to do the job.
Many thanks to those who took time to offer suggestions - much appreciated.
|
|
|
|
|
Dear sir,
i have two list views in window. one for local machine and second for remote machine.
first list view shows files in local machine. and second list view show files in remote machine.
i want to drag one file from first list view to second list view.
could u plz help me??
yogesh
|
|
|
|
|
yogesh_softworld123 wrote: could u plz help me??
There are a number of things here. What do you want help with?
* Listing the files
* Performing a drag/drop operation
* Performing the file copy operation
|
|
|
|
|
drag and drop
but sorry to say
now i have solved that problem
thnk you.
yogesh
|
|
|
|
|
Yogesh, this is third post of yours.... and you are still not clear what you need...
as Colin posted, which operation you need after the drag and drop....
if it is copying files( i assume this - Copping)
then have a look at this article....
Drag and drop, cut/copy and paste files with Windows Explorer
Have a Happy Coding.....
|
|
|
|
|
1. Stop calling everyone sir, we are not a bunch of knights here you know
2. Stop posting the same friggin question every 5 minutes
[EDIT]
2 1/2. Why are you even posting when you clearly are not taking anyones advice anyway?
3. Finally, and most importantly, QUIT TRYING TO BE A PROGRAMMER BECAUSE YOU CLEARLY ARE NOT CUT OUT FOR A LIFE OF USING YOUR OWN BRAIN TO SOLVE A PROBLEM WHICH IS WHAT BEING A PROGRAMMER IS ALL ABOUT!!!!!!!!!!!! (12 should do it, now to bold or not to bold...)
4. Why have you not quit yet?!?!?
<wheres the="" damn="exploding head" smiley="" when="" you="" need="">
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
sorry dear, i was in critical problem. but now i have solved that problem. and i didnt use ur ideas.
and it was my test in one company and now i got job.
thank you very much. in future i will never post any problem here.
is it okkkk???????????????????????????????????????????????????????
and go to hell
yogesh
|
|
|
|
|
you had a test to see if you could get someone to do the work for you? thats a weird one
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
dear Sir, nothing weird about it. He is applying for a managerial job.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
i wish i had known that sooner, i could have got my own company by testing myself how to become a Code Project[^] member
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
yogesh_softworld123 wrote: it was my test in one company and now i got job
Wait a moment! This forum post was part of a technical test in a job interview!?! Isn't that cheating?
|
|
|
|
|
yogesh_softworld123 wrote: in future i will never post any problem here
That's not the idea. This site is here to help people, including you. Reposting the same question repeatedly isn't going to get you the help you seek though. Neither is not following the advice you've been given and not explaining why.
If the advice given was incorrect, then you should post back to the same thread with an explanation of why it didn't help. If it was a problem with the way you expressed the problem, edit the post and the subject will change to modified so others can see it's changed and will reread the question.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
hi every body
i want know how can i convert the audio sample rate and sample size in wave file
Ex: i have audio files with sample size 16bit , audio sample rate 44khz
and i want to change it to 8 bit , audio sample rate 11khz
how can i do this by c#
thanks in advance
|
|
|
|
|
well after a quick google search, see here [^]for details.
I found that WAVE files can be stored in a number of different encodings, see here [^]for details.
So I would suggest finding the encoding you have first. Then you can look into the format of that encoding. For example MP3 encoding details can be found here[^].
Then you can parse the file and change the data you want then save the file again. Simple enough in theory, but are you prepared to attempt the work is the real question.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
i have one gridview the source code of gridview is given below.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" >
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="check" runat="server" Checked="false" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="title" HeaderText="title" />
<asp:BoundField DataField ="firstname" HeaderText="firstname" />
<asp:BoundField DataField ="lastname" HeaderText="lastname" />
<asp:BoundField DataField ="jobtitle" HeaderText="jobtitle" />
<asp:BoundField DataField ="company" HeaderText="company" />
<asp:BoundField DataField ="address1" HeaderText="address1" />
<asp:BoundField DataField ="address2" HeaderText="address2" />
<asp:BoundField DataField ="city" HeaderText="city" />
<asp:BoundField DataField ="state" HeaderText="state" />
<asp:BoundField DataField ="zipcode" HeaderText="zipcode" />
<asp:BoundField DataField ="country" HeaderText="country" />
<asp:BoundField DataField ="email" HeaderText="email" />
<asp:BoundField DataField ="phone" HeaderText="phone" />
<asp:BoundField DataField ="fax" HeaderText="fax" />
<asp:TemplateField HeaderText="requirement">
<ItemTemplate>
<asp:LinkButton ID="requirement" Text='<%#DataBinder.Eval(Container.DataItem,"requirement")%>' runat="server">
</asp:LinkButton>
<%--<asp:linkbutton id="requirement" runat="server" commandargument='<%# Eval("requirement") %>' commandname="Download">download file</asp:linkbutton>--%>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField ="description" HeaderText="description" />
<asp:BoundField DataField ="find" HeaderText="find" />
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
c# code:
protected void btnDownload_click(object sender, EventArgs e)
{
foreach (GridViewRow gvr in GridView1.Rows)
{
CheckBox cb = (CheckBox)gvr.FindControl("check");
if (cb.Checked)
{
string filepath = gvr.Cells[14].Text;
DownloadFile(filepath);
}
}
}
protected void DownloadFile(string filepath)
{
System.IO.Stream iStream = null;
byte[] buffer = new byte[10000];
int length;
long dataToRead;
string filename = System.IO.Path.GetFileName(filepath);
try
{
iStream = new System.IO.FileStream(filepath, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read);
dataToRead = iStream.Length;
Response.ContentType = "application/octet-stream";
Response.AddHeader("content-Disposition", "attachment;filename=" + filename);
while (dataToRead > 0)
{
if (Response.IsClientConnected)
{
length = iStream.Read(buffer, 0, 10000);
Response.OutputStream.Write(buffer, 0, length);
Response.Flush();
buffer = new byte[10000];
dataToRead = dataToRead - length;
}
else
{
dataToRead = -1;
}
}
}
catch (Exception ex)
{
Response.Write("Error:" + ex.Message);
}
finally
{
if (iStream != null)
{
iStream.Close();
}
}
}
error message::Error:Could not find file 'C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\675676'.
any body give me the solution
thankyou in advance
|
|
|
|
|
No one is auditing your entire code, especially when it isn't formatted and put into pre tags, never mind the fact that this isn't the asp.net forum.
|
|
|
|
|
mmmm.... you already posted the solution to your problem. Its clear by the error message is it not?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
here is my error message.
Error:Could not find file 'C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\format.docx'
bellow is my total code
source code
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" >
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="check" runat="server" Checked="false"/>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="title" HeaderText="title" />
<asp:BoundField DataField ="firstname" HeaderText="firstname" />
<asp:BoundField DataField ="lastname" HeaderText="lastname" />
<asp:BoundField DataField ="jobtitle" HeaderText="jobtitle" />
<asp:BoundField DataField ="company" HeaderText="company" />
<asp:BoundField DataField ="address1" HeaderText="address1" />
<asp:BoundField DataField ="address2" HeaderText="address2" />
<asp:BoundField DataField ="city" HeaderText="city" />
<asp:BoundField DataField ="state" HeaderText="state" />
<asp:BoundField DataField ="zipcode" HeaderText="zipcode" />
<asp:BoundField DataField ="country" HeaderText="country" />
<asp:BoundField DataField ="email" HeaderText="email" />
<asp:BoundField DataField ="phone" HeaderText="phone" />
<asp:BoundField DataField ="fax" HeaderText="fax" />
<asp:TemplateField HeaderText="requirement">
<ItemTemplate>
<asp:LinkButton ID="requirement" CommandArgument='<%#Eval("requirement")%>' runat="server" OnClick="requirement_click">download file</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField ="description" HeaderText="description" />
<asp:BoundField DataField ="find" HeaderText="find" />
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
c# code:
protected void requirement_click(object sender, EventArgs e)
{
GridViewRow gvr = (GridViewRow)((LinkButton)sender).Parent.Parent;
if (((CheckBox)gvr.FindControl("check")).Checked)
DownloadFile(((LinkButton)sender).CommandArgument);
}
protected void DownloadFile(string filepath)
{
System.IO.Stream iStream = null;
byte[] buffer = new byte[10000];
int length;
long dataToRead;
string filename = System.IO.Path.GetFileName(filepath);
try
{
iStream = new System.IO.FileStream(filepath, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read);
dataToRead = iStream.Length;
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "inline; filename=" + filename);
while (dataToRead > 0)
{
if (Response.IsClientConnected)
{
length = iStream.Read(buffer, 0, 10000);
Response.OutputStream.Write(buffer, 0, length);
Response.Flush();
buffer = new byte[10000];
dataToRead = dataToRead - length;
}
else
{
dataToRead = -1;
}
}
}
catch (Exception ex)
{
Response.Write("Error:" + ex.Message);
}
if (iStream != null)
{
iStream.Close();
}
}
plzzzzz give me the solution
thank you in advance
|
|
|
|
|
The error message clearly says that the filepath you have given can not be found. so maybe you should check the file is there. try putting the filepath in the error message into windows explorer.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
How can i write a C# script in selenium for Blank username and password feild?
|
|
|
|