
otherside
Avatar/Signature-
Posts
127 -
Joined
-
Last visited
About otherside
- Birthday 12/28/1980
Personal Information
-
Occupation
Univ Student
-
Visual Studio .NET Version
2002 Enterprize Architect
-
.NET Preferred Language
VB.NET
otherside's Achievements
Newbie (1/14)
0
Reputation
-
Hi everyone. I'm trying to use the wizard control in ASP.NET 2. The control renders on a table layout with some mistakes. for example, there is a <tr style="height:100%"> and another <tr> in the same table, this can mess a lot of stuff around it. Is there any way i can change this? (Without rewriting the whole control)? Thanks
-
Return of Autonumber in .NET & SQL Server
otherside replied to otherside's topic in Database / XML / Reporting
OK, here is an example in case someone needs it in the future. Create a stored procedure like this : CREATE PROCEDURE InsertName @NewName nvarchar(50), @Identity int OUTPUT AS INSERT INTO Names (FName) VALUES(@NewName) SET @Identity = SCOPE_IDENTITY() GO on the application part: Dim Con as new SqlConnection("connectionstring") Dim SqlCmd as new SqlCommand("InsertName",Con) SqlCmd.CommandType = CommandType.StoredProcedure SqlCmd.Parameters.AddWithValue("@NewName", "TestName") Dim parm As SqlParameter = cmd.Parameters.Add("@Identity", SqlDbType.Int, 0, "IDColumn") parm.Direction = ParameterDirection.Output Con.Open() SqlCmd.ExecuteNonQuery() Dim ReturnID As Integer = SqlCmd.Parameters.Item("@Identity").Value I think it's pretty easy to understand, if anyone need any clarifications post here. Thanks -
Return of Autonumber in .NET & SQL Server
otherside replied to otherside's topic in Database / XML / Reporting
Thanks for the reply Any examples ? -
Hello guys, I've had this problem before with Access databases and i never bothered to solve because there isn't a real solution with Access databases. Now i'm using SQL server and i know that it can be done but i don't know how. I have a table with one autonumer column for indexing (identity). When i execute the INSERT command i need to get back the number that was assigned. Keep in mind that this is a fast multiuser database (can be 100 inserts/minute) so a SELECT MAX() thing would never work. I'm not familiar with stored procedures etc. If someone could supply me with an example of how this is done through a VB.NET application it would be great. Thanks
-
Hey guys, I have to say ASP.NET v2 is great, fantastic new controls, vs2005 is way better than 2003 etc... But there are issues... 1. Some controls will still produce code not compatible with XHTM and though validation will fail. Anyway that's not the point of the this thread. Here is my problem. Master pages, yeap great new feature. But how on earth are you supposed to refence your files. say images, scripts etc. Example you have the following folder structure: Root+ mymaster.master images+ img.gif pages+ page1.aspx english+ page2.aspx Scripts+ functions.js if you place an image like: <img src="/images/img.gif" /> in the master page, on page1 and page2 that have the mymaster.master as master the reference to the image will be incorrect. Ok ok say you use asp controls for this. <asp:image> etc.. yeah that works.... but what happens when its other stuff like an external javascript file. i put the script inside <head> <script type="text/javascript" language="javascript" src="Scripts/functions.js"> </script> page1 and page2 are trying to find the script on /pages/Scripts and /pages/English/scripts respectively, when it is on /Scripts. also what about in-line styles ? <div style="background-image:url(Images/img.gif)"></div> Is there any solution? am i missing something ?
-
that's not the point ;-) as i mentioned this a simple implementation of a much more complex application. This server variable is controled by a number of other controls and the central page decides which controls to load based on this variable. I found a solution using the pre render event which is executed right before the rendering thanks a log guys
-
no that's not the problem
-
Ok guys this is really stupid, and my mind just stuck now (after about 19 hours of straight coding) Why on earth do i have to click two times the button to write/load the session variable??? and how can i solve it the following is a simple example of what i mean, the actual code is quite long :) Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If IsPostBack Then TextBox1.Text = Session("Test") End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Session("Test") = TextBox2.Text End Sub I write something to textbox 2 and then i have to press twice to come up in textbox 1 ... please help guys.. thanks
-
WELL YOU GUYS WILL NOT BELIEVE IT !!! SORRY FOR WRITING IN CAPS, BUT SOMEDAY SOMEONE MIGHT NEED IT !!! here is the deal, my code was fine (as always hehehe) :PP what is the MAIN difference between the programs ? the way that the file is read. on the c++ in order to read the file the person who wrote the code uses fscanf, which reads ASCII, of course if you consider it it's the same. ....... except...... that fscanf IGNORES THE "CR" CHARACTER 0X0D. it doesn't return it when it reads it from the file... i think that the rest is obvious ....
-
I don't beleive all this time never tried to use the bit shift operation, i was under the impression that it was not included in vb.net Anyway ok i understand your confusion, you have to thing in binary to get it :) we are working with an integer which can have both possitive and negative values. the max positive value is 0x7FFFFFFF. the left shift operation is the same as multiplying by 2. the only difference is that in the shift operation the most significant bit when shifted is erased that way you don't have an overflow. But by multiplying with 2 you will get an overflow. Now if the largest value is 0x7FFFFFFF this means that the last bit is not used in positive numbers. If you erase the least significant bit before the multiplication you won't get an overflow and will be the same as the shift operation. That is why i'm anding with 0x3FFFFFFF. Your code does work but produces wrong result, i'll look in to it to get it solved. Thanks again for the tips.
-
Ok guys i'm losing it here... so any expert who can spare a few minutes take a look. i'm trying to calcute a crc type thing. The code work fine on c++, but doesn't procude the correct result in c# or vb and i really don't get why. Here is the code in C++ int calcrc(char *file) { int crc, i; char car; int ola=0; crc = 0; FILE *File; File=fopen (file,"r"); fscanf (File,"%c",&car); while (ola!=EOF ) { crc = crc ^ (int)car << 8; for (i = 0; i < 8; ++i) { if (crc & 0x8000) crc = crc << 1 ^ 0x1021; else crc = crc << 1; } ola=fscanf (File,"%c",&car); } fclose (File); return (crc & 0xFFFF); } The code in c# public int CRC(byte[] bf,int Len) { int crc =0, i,j; for (j=0;j<Len;j++) { crc = crc ^ (int)bf[j] <<8; for (i = 0; i < 8; ++i) { if ((crc & 0x8000) !=0) { crc = crc << 1 ^ 0x1021; } else { crc = crc << 1; } } } return crc; } and the code in VB.NET Dim fl As New System.IO.FileStream(OpenFileDialog1.FileName, IO.FileMode.Open) Dim chx As Integer Dim i, j As Integer For i = 0 To fl.Length - 1 chx = chx Xor (CType(fl.ReadByte(), Integer) * 256) For j = 0 To 7 If (chx And &H8000) Then chx = chx And &H3FFFFFFF chx = (chx * 2) Xor &H1021 Else chx = chx And &H3FFFFFFF chx = chx * 2 End If Next Next fl.Close() MessageBox.Show(chx And &HFFFF) Ok guys if anyone has any idea why the first one produces the correct the the other not please help. (Note the c# and the VB produces the same result)
-
no i mean outsite the event, ok thank you very much
-
Thanks a lot that worked, it's very similar to what i've tried up until now, i have a question though if that works fine on the itemboundevent why this doesn't work ? TextBox1.Text = DataGrid1.Items.Item(1).DataItem("NName") i get a System.NullReferenceException: Object variable or With block variable not set. exception Thanks
-
Hi guys, I need some help with the datagrids. I've spent all day with books forums etc. but i can't find a solution that works. How is it possible to control the format of every item based on data from a dataset. For example say i have a field called "Result", what i need is if this field is 0 the row to have a background color red if it is 1 green if 2 blue. So what i need is to control some properties from data of a database. Also another example, i have a datagrid with two button columns one pass one fail, but what i need is that the records that have been evaluated not to display these to buttons. Any ideas or code examples are welcome. Thanks