|
Alright,
now i'm getting close to the point. I thin k you have two options here:
-------------
First one:
Use a dictionary to store the textbox and the playerid. Looks somethind like this:
Dictionary<textbox,> dictBoxes = new Dictionary<textbox,>();
dictBoxes.Add(txt0, );
In your storing method you can then access the value:
cmd.Parameters["@PlayerTypeID"].Value = dictBoxes[txt0];
---------------
Second option is to inherit the textbox and add another property:
public class MyPlayerIDTextbox:Textbox {
private string m_sPlayerID;
public string PlayerID {
get { return this.m_sPlayerID;}
set { this.m_sPlayerID = value;}
}
}
Than you have to set the playerid of your textbox once:
MyPlayerIDTextbox txt0 = new MyPlayerIDTextbox();
txt0.PlayerID =
And the storing method will look like this:
cmd.Parameters["@PlayerTypeID"].Value = txt0.PlayerID;
Hope this helps you a bit.
Regards
Sebastian
P.S: I would prefer the dictionary method, it is simplier I think. Or any other suggestions?
|
|
|
|
|
Heya Sebastian,
Wow you were right the Dictionary works perfect, but the only thing is that I have allot of exchange rates to update and insert and it only inserts for one where as I'm trying to insert in one go. Please can you assist if you can?
Oh the second option is quite complicated as you will need to convert a string to an INT32.
But I prefer the First Option much easier and more understandable.
Regards,
Ndeza
/// create the dictionary
Dictionary<TextBox, int> dictBoxes = new Dictionary<TextBox, int>();
/// than put the id in it
dictBoxes.Add(txt0, 0);
dictBoxes.Add(txt3, 3);
dictBoxes.Add(txt5, 5);
dictBoxes.Add(txt55, 55);
dictBoxes.Add(txt6, 6);
dictBoxes.Add(txt61, 61);
dictBoxes.Add(txt76, 76);
dictBoxes.Add(txt77, 77);
dictBoxes.Add(txt81, 81);
dictBoxes.Add(txt9, 9);
//All the parameters that will be added to the database
//also all the from the app
cmd.Parameters.Add("@PlayerTypeID", SqlDbType.Int, 20);
cmd.Parameters.Add("@DateYear", SqlDbType.Int, 40);
cmd.Parameters.Add("@DateMonth", SqlDbType.Int, 4);
cmd.Parameters.Add("@FXR", SqlDbType.Float);
//Assigning the Values to the parameters
cmd.Parameters["@PlayerTypeID"].Value = txt0.Text;
cmd.Parameters["@PlayerTypeID"].Value = txt3.Text;
cmd.Parameters["@PlayerTypeID"].Value = txt5.Text;
cmd.Parameters["@DateYear"].Value = cbmYear.SelectedItem;
cmd.Parameters["@DateMonth"].Value = cmbMonth.SelectedItem;
cmd.Parameters["@FXR"].Value = txt0.Text;
cmd.Parameters["@FXR"].Value = txt3.Text;
cmd.Parameters["@FXR"].Value = txt5.Text;
cmd.Parameters["@FXR"].Value = txt6.Text;
cmd.Parameters["@FXR"].Value = txt9.Text;
cmd.Parameters["@FXR"].Value = txt55.Text;
cmd.Parameters["@FXR"].Value = txt61.Text;
cmd.Parameters["@FXR"].Value = txt76.Text;
cmd.Parameters["@FXR"].Value = txt77.Text;
cmd.Parameters["@FXR"].Value = txt81.Text;
|
|
|
|
|
I have a Asp.net C# site(A) in which there is 3 Iframes Header ,body and footer.........
In header there is a droupdown which is filled by database ,which contain links to another sites(B).now when user click and sellect droupdown the site(B) is open in the body Iframe of site(A).
Now when i open this site(B) by typing the address in the browser,then it will work fine and all the ajax control work.But when this site(B) open in the body frame of my site(A) then AJAX control stop working and evertime whole frame get refreshed......WHAT TO DO as i have to open different sites in my one site as per the selection,Ajax is not working.
modified on Wednesday, October 15, 2008 1:44 AM
|
|
|
|
|
Post the question on ASP.NET Fourm
cheers,
Abhijit
|
|
|
|
|
Hi,
I am using datagridview when, I am assigning datasource to Datagridview i am
gettin exception "Child list for field Region cannot be created."
I am Assigning Collection as a datasource to the datagridview.
AnnotationGrid.DataSource = XMLAnnotations;
AnnotationGrid.DataMember = "Region";
and my grid has three coloumns ID, Area, Text and XMLAnnotation consist xml
like that :
<Annotations MicronsPerPixel="0.504000">
- <Annotation Id="1326" Name="" ReadOnly="0" Type="4" LineColor="2293538"
Visible="1" Selected="0" MarkupImagePath="">
<InputAnnotationId>0</InputAnnotationId>
<Attributes />
- <Regions>
- <RegionAttributeHeaders>
<AttributeHeader Id="9999" Name="Region" ColumnWidth="45" />
<AttributeHeader Id="9997" Name="Length" ColumnWidth="70" />
<AttributeHeader Id="9996" Name="Area" ColumnWidth="70" />
<AttributeHeader Id="9998" Name="Text" ColumnWidth="100" />
</RegionAttributeHeaders>
- <Region Id="1326" Type="1" Zoom="0.000000" Selected="0" ImageLocation=""
ImageFocus="0.000000" Length="244.0" Area="3237.0" LengthMicrons="123.0"
AreaMicrons="822.2" Text="" NegativeROA="0">
<Attributes />
- <Vertices>
<Vertex X="23686.000000" Y="20753.000000" />
<Vertex X="23769.000000" Y="20753.000000" />
<Vertex X="23769.000000" Y="20792.000000" />
<Vertex X="23686.000000" Y="20792.000000" />
</Vertices>
</Region>
</Regions>
</Annotation>
- <Annotation Id="1328" Name="" ReadOnly="0" Type="4" LineColor="2293538"
Visible="1" Selected="0" MarkupImagePath="">
<InputAnnotationId>0</InputAnnotationId>
<Attributes />
- <Regions>
- <RegionAttributeHeaders>
<AttributeHeader Id="9999" Name="Region" ColumnWidth="45" />
<AttributeHeader Id="9997" Name="Length" ColumnWidth="70" />
<AttributeHeader Id="9996" Name="Area" ColumnWidth="70" />
<AttributeHeader Id="9998" Name="Text" ColumnWidth="100" />
</RegionAttributeHeaders>
- <Region Id="1328" Type="1" Zoom="0.000000" Selected="0" ImageLocation=""
ImageFocus="0.000000" Length="166.0" Area="1380.0" LengthMicrons="83.7"
AreaMicrons="350.5" Text="" NegativeROA="0">
<Attributes />
- <Vertices>
<Vertex X="23715.000000" Y="20825.000000" />
<Vertex X="23738.000000" Y="20825.000000" />
<Vertex X="23738.000000" Y="20885.000000" />
<Vertex X="23715.000000" Y="20885.000000" />
</Vertices>
</Region>
</Regions>
</Annotation>
</Annotations>
|
|
|
|
|
Hi Friends,
i want to send key-value pair values on HTTP Request using C#. If anybody know how to send key-value pair values then please send me hint.
Regards
Bill
|
|
|
|
|
The HTTP protocol is well documented.
How does this question apply to C#? Are you using a .NET
HTTP class?
If you're using HttpWebRequest you can use its Headers property
to get a WebHeaderCollection. WebHeaderCollection.Set() can be used to
add header key/value pairs (if that's the key/value pairs you're
referring to).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have an oracle function.It works fine when it is static.
If i create the same function dynamically though asp .net code the error comes.
I tried this code ALTER FUNCTION Group_concat COMPILE
This code works manually.But in the run time it does not work.
Give me solution if anyone knows.
Thank you
|
|
|
|
|
froxy wrote: If i create the same function dynamically though asp .net code the error comes.
What error? And what code? (Describing the code does not count)
|
|
|
|
|
Few issues:
- why do you want to compile the function from code. You may run into trouble with that
- most likely your connection hasn't got enough privileges
- if you need to create a pl/sql block at runtime, perhaps you could use anonymous blocks
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
hi every body...........i have a problem.i have a web page in which i m uploading an video file by using fileupload control.......before uploading that video file i m checking the size of that video file by the variable FileBytes.then i m checking it with the drive free space .......but this exception named System.OutOfMemoryException occured when i upload the video file of more than 500 MB...the coding i m using is ..........
byte[] FileBytes = FileUpload.FileBytes; // the problem is coming in this line as byte is small datatype for the video file of more than 500 MB
long freespace =drInfo.AvailableFeeSpace;
i want to upload video files of more than 500 MB ...it may be in GB's also
preeti1979
|
|
|
|
|
You are trying to store half a gig in RAM. Using this technique you will need sufficient RAM to achieve yout task and allow everything else that is running to continue to do its job.
|
|
|
|
|
i have sufficient RAM (2 GB) to store these files.but my problem is that whem i m checking the size of the file i m uploading i have taken the datatype as byte which is not sufficient for the files of size more than 500 MB..what data type can i use to store the size (in bytes) of more than 500 MB....
|
|
|
|
|
Can you upload without loading the entire file into RAM
(i.e. upload in chunks)?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Error
Specified argument was out of the range of valid values.
Parameter name: index
while i'm loading the page, error will come in this code
protected void grdEncounter_RowDataBound(object o, GridViewRowEventArgs e)
{
GridViewRow grdEditRow = e.Row;
if (grdEditRow.RowType.Equals(DataControlRowType.Header))
return;
grdEditRow.Cells[2].Text = grdEditRow.Cells[2].Text.Equals("1") ? "Yes" : "No";
//error comes under above line
}
thanks in advance
|
|
|
|
|
kankeyan wrote: Specified argument was out of the range of valid values.
Parameter name: index
kankeyan wrote: grdEditRow.Cells[2].Text = grdEditRow.Cells[2].
It looks like you're trying to access the 3rd cell (zero based index) which doesn't exist as the error message says.
set a breakpoint on that line and examine the cells Count property.
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)
|
|
|
|
|
Already posted 3 times. Try reading the answers people give you!
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Ok so im making a program in C# to be a desktop based version of our AJAX chat on our site. The AJAX chat reads messages and other info from the main SQL database on the site.
Now my program does the same. BUT the problem is that the program is still decompilable(which means that anyone can get our SQL username and pass).
So how do people normally stop this?Surely im not the only one making a program that has sql info in it?
Now i first thought I could just use an Obfuscator but after reading around it seems that even that will only ward of beginners.
Please help thanks!
|
|
|
|
|
roguemat wrote: the program is still decompilable(which means that anyone can get our SQL username and pass).
Have you never heard of a trusted connection?
roguemat wrote: So how do people normally stop this?
I use trusted connections.
|
|
|
|
|
No, i havent :-/
Are you talking about web services?
thanks
|
|
|
|
|
No, I'm not talking about web services.
A trusted connection is one where the SQL Server accepts your current Windows Domain login to connect to the database.
Remove the user name and password from your connection string and replace with Trusted_Connection=yes
For more information about the various ways you can connect to databases see Connection Strings[^]
|
|
|
|
|
thanks man
EDIT: hmmm it seems like this would require me to add every user that uses the program to the database(well their windows login)? This is possible as there are a couple thousand users
|
|
|
|
|
You can add windows (NT) groups rather than individual users, that may help.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Well that doesnt really help because I have no clue who the users will be? Think of it like CodeProject making a windows based MessageBoard viewer...they dont have any idea what users are going to be viewing their program. So they would have to have SQL info in the program, but then would be scared that someone would decompile it and get their SQL info..
|
|
|
|
|
Then you (don't) use SQL's built in security to lock their access down to a couple of stored procedures.
Use a webservice, and give the webservice access to your database server. Letting random people on the internet connect directly to your server is just asking to be owned, unless you know exactly what you are doing.
|
|
|
|