|
havelock posted:You can keep using WebRequest. I believe there's a Credentials property off of request that you can add stuff to. new NetworkCredentials (UsernamePasswordCredentials?) or something like that. For the record, this does not work. That'll work for Windows Authentication, but not Forms Authentication. I ended up doing some "scraping" code-- getting the logon form for the viewstate, posting back to it with the login/password, then getting the authentication cookie from that response.
|
![]() |
|
![]()
|
# ? Jun 10, 2024 17:01 |
|
This is a bit of a longshot but I am trying to connect to a SQL Server 2000 database and fill a dataset with some tables. I am either getting a 'Internal Fatal Connection Error' or a timeout, and which one seems dependent on the table I'm querying. Conversely if I do select * from table and execute a data reader it works. Does anyone have any clue what I might have made an error in or what is causing the internal error? Here is the connection string databaseConnection.ConnectionString = "Data Source=xxx.xxx.xx.xx,xxxxx;Network Library=DBMSSOCN;Initial Catalog=xxx;User ID=xxxx;Password=xxxxxxxxxxx; Trusted_Connection=False"; Here's the SqlCommand SqlCommand sqlCommand = new SqlCommand("", databaseConnection); Here's the fill code DataAdapter.SelectCommand = sqlCommand; DataAdapter.SelectCommand.CommandText = "SELECT * FROM tbl1"; DataAdapter.Fill(CommonVariables.DataStorage); edit: I'm trying to pull about 2k records. I've tried setting the time out for 600 seconds, attaching the database on my local machine. Not having any success. Smaller tables (200 records or less) are handled ok. Nurbs fucked around with this message at 19:55 on Jun 11, 2007 |
![]() |
|
Stramit posted:I have been developing an application for university over the past few weeks, it's a system with a database back-end and has been fully developed and ready for deployment over IIS. I don't use Sql express, but I think changing the User Instance parameter to true will fix things.
|
![]() |
|
Nurbs posted:This is a bit of a longshot but I am trying to connect to a SQL Server 2000 database and fill a dataset with some tables. I am either getting a 'Internal Fatal Connection Error' or a timeout, and which one seems dependent on the table I'm querying. Try selecting the top 10 or 100 records and see if the problem persists. And is there any reason why you are forcing a TCP/IP connection?
|
![]() |
|
How do you set the main form in C# using Visual Studio ? Say I have 2 forms, form A and form B. Currently the default main form is form A and I wish to change it to form B instead. How do I do this ?
|
![]() |
|
Verve posted:How do you set the main form in C# using Visual Studio ? Open Program.cs, and where the line: code:
|
![]() |
|
Verve posted:How do you set the main form in C# using Visual Studio ? By main form, are you referring to the Start Page? If so, just right click on it in the solution explorer, and select "Set As Start Page". Edit: totally missed that one, I guess.
|
![]() |
|
I am in some need of help for SQL related stuff. I think I mentioned before that I'm a huge SQL newbie, so bear with me ![]() I need to accomplish the following things: 1. Connect to my database. 2. Insert a row of blank data in the main table, obtain the value of the primary key of the row I just inserted, then assign that value to an instance variable. 3. Update the main table with information from an .xml document. 4. Upload files into the DB. My company previously wanted me to create a ASP.NET/C# code behind website to accomplish all this, in which SQLDataSource worked absolutely wonderfully for (to transfer data from the .xml document to the necessary tables, not for transferring files). But since they scratched that, I now have to create a C# console program that would essentially do the same thing. Upon looking at the MSDN, I discovered a jumble of potential classes to use, in which I'm not even sure where to start with. It's been recommended to use a SQLDataAdapter and a DataSet to connect and modify the database, but I think logically, it would take more time since all I'm doing is simply transferring information from an .xml to SQL tables, then transferring files. What's the easiest and most elegant way to accomplish this? Recommend me a way to start, as I'm really not sure exactly how to go about this. I've been reading Programming C# by Jesse Liberty (the O'Reilly series), but it shows a very basic example of messing around with SQL DB's. Anyone know of good guides for this? Thanks as always!
|
![]() |
|
First--forget about datasets, and data adapters, and DataSourceControls. This is a job for plain old SqlConnections, SqlCommands and DbTransactions. Not quite in a code writing mood, but I will try and steer you in the right direction: 1) Use the SqlConnection to create connections. 2) You probably want to combine this and #3 into one command, no need to hit the DB twice. The best way to do this in general is to use an output parameter to capture the value of the sql SCOPE_IDENTITY() function. Something like: code:
4) You can use similar methods to upload files. Just read them into a byte[] and use a parameterized statement to INSERT them, capturing an ID like above. One other note--you might want to run this entire operation, or at least individual iterations, within a DbTransaction. This means that if something fails, the whole kit and caboodle will get rolled back. Hope this helps.
|
![]() |
|
And now, to the GUI portion of our competition. Two quickies involving win forms: I have a ContolSet control with a Fixed3D border. However, the normal 3D border makes the control look sunket; I want to make the control look raised. Basically, I need to invert the shadows and the hilights. Is there any (easy) way to do this? Also, I have a ListView embedded in said ControlSet. I have this ListView anchored in all four directions, however at a certain size (namely, when the window is sized too small to see the ListView at all) I want to the ListView to stop resizing and just hold its height, wherein the ControlSet's auto-scroll property should kick in. I tried setting the MinimumSize property of the ListView, but it doesn't seem to have any effect. I know I could probably do this by hooking OnResize and computing it manuall, but is there an easier way?
|
![]() |
|
Magicmat posted:And now, to the GUI portion of our competition. Two quickies involving win forms: quote:Also, I have a ListView embedded in said ControlSet. I have this ListView anchored in all four directions, however at a certain size (namely, when the window is sized too small to see the ListView at all) I want to the ListView to stop resizing and just hold its height, wherein the ControlSet's auto-scroll property should kick in. I tried setting the MinimumSize property of the ListView, but it doesn't seem to have any effect. I know I could probably do this by hooking OnResize and computing it manuall, but is there an easier way? Also, what is a ControlSet control? I'm assuming that it's a custom control, hence the override suggestion above. If it's sealed or you can't override it, you can use the Paint event. ![]() SLOSifl fucked around with this message at 17:47 on Jun 14, 2007 |
![]() |
|
This has probably already been asked but searching does not seem to work right now. In VB.net what does dim stand for? I have heard dimension but that does not make any sense to me.
|
![]() |
|
It's dimension. It means something along the lines of "allocate space (dimension) in memory for this variable". I don't think you'll get much more of an answer than that though. edit: These seem reasonable: Dictionary.com posted:Dimension SLOSifl fucked around with this message at 18:32 on Jun 14, 2007 |
![]() |
|
This is a real long-shot, but I'm always amazed by how how drat smart folks in this thread are, so maybe someone can help me. I'm using Index Server for full-text searches on dynamically generated site(s) on the server. I've got a management console that creates the site and automatically creates the index server catalog as well. I'm using a combination of the CIODMLib COM interface and registry manipulation to automatically create the catalogs. When my code is done, you can use the index server manager plugin to see that the catalog exists in Index Server, the proper directory is added, and the "Generate Abstracts" checkbox is checked. Here's some sample code: code:
characterizations(abstracts). Am I missing something critical? Has anyone else managed to do this? Edit: And again struggle for days, break-down and post the question, then figure it out on my own minutes later. I needed to set additional registry entries: FilterFilesWithUnknownExtensions and MaxCharacterization. Dromio fucked around with this message at 21:40 on Jun 14, 2007 |
![]() |
|
I'm have some questions about serialization that I hope someone can help me with. I wrote a little program to test out different serialization techniques which raised some questions. I'm basically saving a class which contains a int. The first thing I noticed is that each instance of my class has a built in overhead of 14 bytes - is that normal? I there a way to decrease that? The second issue is that if I implement ISerializable it's slower both serializing and deserializing. I can't imaging I'm doing anything too different than what the built in serialization engine does but obviously that's the case. Here's the output I get code:
code:
|
![]() |
|
SLOSifl posted:Override OnPaintBackground and use the static ControlPaint.DrawBorder3D method to draw the border. You can probably leave the base.OnPaintBackground(e) call in there to ensure the rest of the control looks normal.
|
![]() |
|
Stramit posted:This is the connection string I am using (this does work locally): That AttachDBFilename thing in your connection string looked suspicious to me, so I went to check http://www.connectionstrings.com/?carrier=sqlserver2005. According to that page, the AttachDBFilename=whatever option only works for local SQL servers. So if you have seperate machines for IIS and SQL server (as I suppose you do), your connection string will not work. From your error message, it looks like you're using the .NET sqlconnection, so your connectionstring should probably be something like: "Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;"
|
![]() |
|
This is a little awkward, but I have a database I need to get to PocketPC. My supervisor wants me to write a C# dll to serialize the needed tables, and modify the vb6 PocketPC application to receive the table data serialized by C# and run SQL queries on it. As far as I can tell, there is no easy way to do this. .NET doesn't do DAO (to my knowledge,) and vb6 doesn't do ADO.NET (obviously.) I was thinking about using vb6 to create the dll and SOAP to transfer the data. Any ideas? Edit: Nevermind. Turns out we're rewriting the PocketPC application to .NET. Fun. Shayla fucked around with this message at 16:28 on Jun 18, 2007 |
![]() |
|
^^^^^Ever consider Sql Mobile--it is made for scenarios such as this.
|
![]() |
|
Magicmat posted:That method for 3D borders works great! Except that it also draws the border of all containers within the control as having the same "raised" border. For example, I have a table layout control in my custom control, and it, too, gets a 3D border, even with its boeder set to "none" in the designer, which I don't want. Is there any way to get around that?
|
![]() |
|
Not really a programming question, but I could use a recommendation on a charting package for .Net. Our immediate need is for ASP.NET charting, but I can foresee us using charts in Windows Forms down the road, so a package containing both ASP and Windows Forms components is desirable. It seems like there are a lot of offerings, so I'm looking for some input with regard to what you may have experience with, positive or negative.
|
![]() |
|
MrBishop posted:Not really a programming question, but I could use a recommendation on a charting package for .Net. Our immediate need is for ASP.NET charting, but I can foresee us using charts in Windows Forms down the road, so a package containing both ASP and Windows Forms components is desirable.
|
![]() |
|
These guys seem pretty competant: http://www.devexpress.com/Products/NET/WinForms/XtraCharts/ We dont use the charts but we do use some of their other products. Plus their charts look nice and work in ASP.NET.
|
![]() |
|
I'll probably figure this out on my own like last time as soon as I post the thread but I'm kind of stuck. I want to bind a datasource with a combobox and then force the combobox to drop down and show what is in the table I just bound to it (basically I'm feeding the results of a search into the combobox). I can't figure out how to get the drop down event to fire. Doing combobox.dropdown() generates a syntax error.
|
![]() |
|
Nurbs posted:I can't figure out how to get the drop down event to fire. Doing combobox.dropdown() generates a syntax error.
|
![]() |
|
Ch00k posted:combobox.DroppedDown = true; Thanks!
|
![]() |
|
wwb posted:First--forget about datasets, and data adapters, and DataSourceControls. This is a job for plain old SqlConnections, SqlCommands and DbTransactions. Not quite in a code writing mood, but I will try and steer you in the right direction: Okay...I think I have something going now. Thanks a ton, I appreciate it!
|
![]() |
|
SLOSifl posted:I didn't know it would do that. Maybe override OnPaint instead? Or use the Paint event rather than overriding anything? There has to be a method for only drawing a border around the control as a whole. At the very least, I think I could get the control's size and always draw to that, but even then I'm drawing the border twice more than necessary.
|
![]() |
|
I end up doing this a lot of times, and keep thinking there must be an easier way. With the framework so big, maybe there is and I just don't know about it. Does anyone know a simple way to convert an IEnumerable to a comma-seperated list in a string? Right now I'm doing something like the following: code:
|
![]() |
|
There is a more intelligent way--use xml for output. Now, to ease things, one could it an array of strings and use the Join method. Now, that does not take care of quoting things intelligently.
|
![]() |
|
Aha, see I knew there was something simple I was missing and it was just too generic to google. String.Join is exactly what I wanted. I feel foolish. Thank you.
|
![]() |
|
Dromio posted:I end up doing this a lot of times, and keep thinking there must be an easier way. With the framework so big, maybe there is and I just don't know about it. edit: whoops, beaten. Forgot to refresh.
|
![]() |
|
I'm using ASP.NET 2.0 mobile controls, and I'd like to be able to set the width of a mobile:command control, but it doesn't seem to have that property. Is there any way to do this? I'm obviously using Format="button" because setting the width of a text link wouldn't make sense Thanks!
|
![]() |
|
Do any of you guys use NHibernate 1.2? I'm having some serious issues with my latest application, and I'm at my wits end. When a user is in the application, it will be blazing fast for a random period of time. All of a sudden, it will slow to a crawl and a page request will take upwards of 20 seconds to show up. Later, it will be blazing fast again. The ASP.Net session is stored in the database, and the NHibernate session is opened for the length of each request. We are aware that opening a session for the length of each request is an expensive operation, but the load it is causing on our servers so far is minimal, so I do not think this is the issue. Everything else about our project is pretty much a standard NHibernate setup as per the NHibernate documentation.
|
![]() |
|
Magicmat posted:I tried setting an event on the OnPaint method, but still the same thing. I even tried filtering by sender, but the sender is always my control. It gets called once for each control on my control, an imagebox, a tablelayoutpanel and the control itself. I tried filtering by sender, but the sender is always my own custom control. I even put a message box in the event, and I can see the drat thing draw a new 3D border around each control. Update: Further testing showed that with the above method, there was unpredictable behavior when resizing the control. Repainting when, for example, you were moving another window over your application worked fine, but resizing caused the background to flicker in and out. So, back to redrawing the border every time OnBackgroundPaint is called. If anybody knows of a better way, I'd love to hear it. Edit2: My atrocious spelling may explain my explain my preponderance of bugs. Magicmat fucked around with this message at 10:23 on Jun 22, 2007 |
![]() |
|
Hey all, I'm having an issue dynamically creating LinkButtons. Here's what I'm trying to do: I'm keeping track of what state my page is in with some static variable, nothing crazy about that. Based on that value, I want to Query a database and generate a list of LinkButtons based on the returned values during the OnLoad of a Table that exists in the page. I can query the data no problem, and I can create the TableRows, TableCells, and LinkButtons, but for some reason they are showing up the NEXT time the screen posts. I tried creating the buttons in the OnPreRender stage also, but then button.Click += EventHandler("Button_Clicked"); doesnt register the event handler anymore. Also, when I click a button, I want it to change color indicating the selection, but this is also not happening until the NEXT time the page posts. I know my problem is becasue the page_load stage is occuring BEFORE the "Button_Clicked" function code is handled. How the hell do I change the appearance of the buttons if I can't tell which button was pressed until AFTER the page_load stage?
|
![]() |
|
Thecate posted:Hey all, You could update the display in the event handler maybe, that's about all I can offer without seeing more code.
|
![]() |
|
Hi folks, I am pulling data from a database, loading it into a dataset and then pulling some of it out with a dataset[currentTable].Select(filterExpression) which returns an array of datarows. What is the best way to bind this array of datarows to a datagridview? simply setting the datagridview.datasource = datarowarray doesn't quite do it. Ideally I'd like the column headers to be mapped as well. Would prefer to write a function so I can make iterate through the columns and set their visibility.
|
![]() |
|
Thecate posted:Hey all, First, that static object will bite you in the rear end. Unless you want every single user sharing data, then it makes sense. Not exactly sure what is going on here, but a better plan is to park your data in an appropriately backed object and then databind to that once you handle your events. It is alot cleaner and one need not gain a PHD in page lifecycles to make things work.
|
![]() |
|
![]()
|
# ? Jun 10, 2024 17:01 |
|
Nurbs posted:Hi folks, You are halfway there. You also probably need to call DataBind() after you set the datasource. Insofar as column headers go, you would probably have to iterate through the results after the table is bound and match up columns. Of course, if you are not dynamically picking columns as well, you could just write them in the aspx code and call it a day.
|
![]() |