Hi guys what is wrong her keep getting this error: " Parameterized Query '(@type nvarchar(4000))select price from titles where type=@type' expects parameter @type, which was not supplied " I think it's something to do with my QueryString, which seems to be null, but I don't know how to fix it - any suggestions please.... Here is a code snippet: strType = Request.QueryString["type"]; //using pubs database strSelect = "select price from titles where type=@type"; cmdTitles = new SqlCommand( strSelect, conPubs ); cmdTitles.Parameters.Add("@type", strType); conPubs.Open(); rptTitles.DataSource = cmdTitles.ExecuteReader(); rptTitles.DataBind(); conPubs.Close(); All the best Al
ComCoderCsharp
Posts
-
What is wrong here.. -
suggestions for sliding images on my websiteHi guys I want my webside to be able to slide pictures after pressing a linkbutton. Do you have any suggestions how to load the pictures. I have tried to load it directly from my folder after the linkbutton is pressed and thereby updating a counter variable, but my problem is that every time the linkburtton i pressed the page is loaded again and the counter is reset to its original value, how can I get around this problem?... Regards Al
-
How to run a sql script in Visual StudioHi guys Can anyone tell me how I can run a sql sript in visual studio 2005 for implementing a table into my database. The microsoft homepage says something about dragging the script into the reference folder but I can't seem to get it work. Is there someone who can help me... Cheers Al
-
Please Heeelp - connection error driving me crazyHi thanks for the reply Maybe this could be the solution.. but it leads me to another question: How do I add windows authenticated login and give permission to the appropriate database, I can't seem to figure it out...sorry if this is a stupid question, I'm kind of new to configuring the database connections... Thanks in advance Al
-
Please Heeelp - connection error driving me crazyHi guys I'm working in Visual studio on a website and using ADO.NET to connect to my pubs sql-database. I keep on getting error messages when I test the website in my browser. Is there anyone who can tell me what could be wrong - I've been through all the configurations steps e.g setting the remote connections... at least I think so... I've gotten error messages like "login failure" and "The user is not associated with a trusted SQL Server connection" what might be wrong??????????? The strange thing is that if I chooe e.g. a gridview from the toolbox there is no problem at all for this autogenerated gridview to connect to the server - how can this be? - I've tried to use the autogenerated connection string from the toolbox gridview, but that doesn't seem to help... her is some connection string that I have tried out string CONN_STRING = "Server=.\\SQLEXPRESS;Initial Catalog=pubs;Integrated Security=SSPI"; or string CONN_STRING = "Server=.\\SQLEXPRESS;Initial Catalog=pubs;uid=sa;pwd="; please someone help me... All the best Al
-
how to query by distanceHi guys I've have set up a data-table in MS Access. I have a colomn with the names of my data and a column with numbering of the data (One number for each name). I then have a new entry of data, which I want to compare to the data in my table. I want to do this by calculating the distances between the new data and all of the data (numberings) in the data-table. Finally I want to choose the ten data-items from the tables, which have the shortest distance to the new data-entry. My problem is... How can I in sql-code calculate the distances, one row at a time - save them and later compare all the distances and choosing the ten shortest ones. I haven't done much sql-code before - so i would really apreciate any suggestions or maybe some good links Thanks in advance AL
-
How to communicate with my database over the InternetHi everyone I've done a Windows application in C# where I can retrieve data from a database. But I want to port my database records to a server and then let my Windows appl. getting the the through the internet. Do you know of some easy way to handle this problem... All the best Al NB I'm using ADO.NET for querying
-
Retrieve data from a Dataset into an string array - how??Hi everyone I'm having a problem where I want to retrieve data from a MS Access database using ADO.NET. I'm using a 1D dataset to get the data from the database and now I want to further copy the data from the dataset into a string array. I've tried several things but nothing seemes to work out. Plaese give me some suggestions on have this could be done, maybe I shouldn't use a dataset at all?... Best wishes Al
-
Dataset to array?Hi guyes Does anyone know how to convert the data in a dataset into an array. All the best Al
-
How can I do some audioprocessing while playing...Hi Everyone I'm doing a program where I want to play an audio file. In the mean while I want to do some audio processing in the background which in my case is quite CPU demanding. My concern is that I want be able to play music simultaneously and have to wait for the processing... so I was thinking if someone has some suggestions on how this can be done :confused:... Thanks in advance Al
-
how to get the duration of an mp3 fileIf you know the samplingsfrequency Fs and number of samples N: duration = N/Fs [sec] Cheers Al
-
How to retrieve the amplitude samples from a sound fileHi coders I'm working on a project, where I'm to do some calculations on sound-data. I have no problem playing the sound and so on. But I can't figure out how to retrieve the amplitude samples and put them into an array so I can do my calculations. Is there please some how can help me or give me som hints... All the best AL
-
Primitive types or object types what to preferHi again Thanks for the answer. I agree on what you are saying, this is how I have done it through out my project. I just wanted to know if there possible was a better way. My concern was that when I use a Complex array of e.g 100000 values and every time using the "new" inside a loop and thereby assigning a new memory location every time, would lead to a unnessecery usage of memory. So initially I was wondering if this could be avoided using primitive types. But this does not seeme to be the case - I think:) All the best T
-
Primitive types or object types what to preferHi again I have read a bit up on which types to prefer and it seems to me that defining a struct and using it as a primitive type, would be the same as just using primitive types which are structs themself. This means that if I want to represent some complex data (Re,Im). I could do it using two e.g float arrays representing the real part and the imag part, but it would be the same, if I used a struct called Complex(float,float). In other words: float[] = realdata; float[] = Imagdata; would be the same as: Complex[,] = new Complex(realdata,Imagdata); Right? :^) All the best T
-
Primitive types or object types what to preferThanks for your answers guys It really cleared some things up for me. The thing is that I'm doing some complex numbers math on sound data, so memory space is important. I'm using about 2^16=131072 samples data and if I do the Fourier transformation this will double up, because of the complex representation. This will end up something like 2^16*2*16=4194304 bytes ~4.2M which is a lot. So I'm thinking maybe I should do it the hard way... If you you have something to add I'm open to suggestions...:) Best wishes T
-
Primitive types or object types what to preferHi everybody I'm doing a project were I need to do some advanced calculations on complex numbers. So I'm wondering if I should use a struct/class to represent the Complex data or should I use two arrays of primitive types to handle the real and complex part seperately. Is it more memory effecient to use primitive types than self-defined types?. I have read somewhere that primitive types in C# are objects themself, so I was wondering, if I define e.g a ComplexNumber class, would it be the same as using e.g float which is inheritet from System.Object?... Thanks in advance T
-
How can I avoid a for-loop and speed up my codeHi coders Just wanted to say thanks for all your many inputs - As expected there seems to be no magic answer to this quistion, but I will take a closer look at using pointers - I did not know this was possible in C# so thanks alot... AL
-
How can I avoid a for-loop and speed up my codeHi coders I'm doing some advanced calculations mostly on sound, but I'm relative new to C#...so I was wondering if anyone has some advice on how I can (if possible) speed up the more primitive part of my code...e.g when I want to multply to arrays colmnwise. In Matlab this would look like Z=X.*Y but I cannot figure out a smart way to do this without using a for-loop in C# like for (int i = 0; i < length; i++) { Z[i]=x[i]*Y[i]; } As you can see, this takes a long time if the array consist of a sound segment of e.g 3 seconds which is 132300 samples. Do you know of any better way how this can be done... Best regards AL
-
How can I display a rather large array in a datagridHi everyone I have generated a 2D array (like a matrix) which is rather large and I want to find som simple way to display it in e.g a datagrid. Is there anyone how can tell me how this is done. I have seen the examples on the net, but they only show how you can do this for a simple array... Thanks in advance AL
-
How can I acces a C++ library in C#Hi Guys I heard my teacher talk about that it was possible to acces C++ code and import it into C# using .Net... Is there maybe someone how has done this before and can provide me with som samples. I'm thinking about accesing a C++ -library containing FFT (Fast Fourier) for my signal processing project, which is being programmed in C#... is this possible? seems difficult to find any good FFT implementation in pure C#... Thanks a lot AL