mobigital's Q&A profile
SQL Server Dynamic query
Hello I have a problem with writing a query.Let me give an example: Table: ColA , ColB , ColC , Col1 , Col2 , Col3 , Col4 , Col5 Ok.I must write a SP and it gets a parameter,say @param. if @param=1 then in the select statement I will select Col1,if @param=2 then I will select Col2 and so on. How can I do this Thanks. Joey gives an answer how. You could also do: declare @query varchar(max) set @query = 'select col ' + cast(@param as int) + ' from table' Or if the column names aren't actually numberd, use a CASE expression to pick the columns. The question I have is why do this If all columns are only useful one at a time, this is probably a design issue. If this is to support some use ...Show All
Visual Basic Unhandled Exception When Launching Application - Attach Database Failed
Hello, I am launching a VB app that I built with a SQL backend. I am getting the following error message: "Unhandled exception has occurred in your application. .... An attempt to attach an auto-named database for file .....mdf has failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share." Does anybody have any idea what could be causing this and what I would need to do to overcome this Here are the details from the error dialog. Thanks for your assistance. See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.Data.SqlClient.SqlException: An attempt to attach an au ...Show All
SQL Server SQLExpress, locked files, and sp_detach
I have a situation where I want to copy a SQLExpress mdf file, after having read some metadata from it, but I find that an exclusive lock persists on the file for about 5 minutes after closing... the lock is held by "sqlservr.exe" This lock prevents me from copying the file. It seems that I may be able to fix this by calling sp_detach_db after closing the connection (does this seem reasonable ) but I am unsure what the database name (dbname) is that I need to pass to sp_detach_db. To make this a little more concrete, here is the connection string I use... "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\testdata\DVDCollectionDatabase.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True'" so in that case what ...Show All
SQL Server Why can I not read VARCHAR(MAX)?
Hi there. Can Anyone help We have recently started to use SQL Server 2005 Express for a client. We have to accommodate some fields which exceed the 8000 character size for a VARCHAR, and all the advice says to use VARCHAR(MAX). If we do, we can place data there, but seem unable to read it back. We are interrogating via ODBC (SQL Native Client) using ASP (not .NET) on a windows 2003 server via IIS. We can find nothing at all on the web to help solve this problem, and apparently no-one else who has come across it. It is a standard (typical) installation of SQL Server 2005 Express, as far as we know. If we use a 'Text' Data type, it works, but not with VARCHAR(MAX) Any ideas out there This is ...Show All
Visual C++ Wrong line indicated as PC in dlgcore.cpp
A C++/MFC project has a CDialog-derived class, which has a template created using the dialog editor, and is instantiated in a CWnd-derived main window by CMyDialog* pDlg=new MyDialog; nResponse=pDlg->DoModal(); delete pDlg; To track down another problem, I tried stepping through the DoModal code, which is in dlgcore.cpp as INT_PTR CDialog::DoModal(). However, the debugger's yellow arrow is a few lines off in the source code; the first line shown is in CDialog::PostModal, exactly 8 lines above the left brace which begins function DoModal. Have I got an incompatible set of MFC source files This is VS2005 SP1. hello refer to the debugger FAQ in visual studio debugger forum, you can find ...Show All
Visual Studio Quickest way to Download all folders and files after initial connection to ini - VSS 2005
Just installed VSS 2005. I connected to our DB ini. What's the quickest way to create all the folders in my wwwroot that exist in our VSS datbase Do I have to do this manually as I have been doing by going into VSS, and setting the working folder and creating the folders from there Or, can I just go to our server, copy the entire structure down, then go back into source safe and set each working folder I just want to know if it is safe to copy down from a mapped drive or something, all the folders manually or do I need to go through VSS. If through VSS what's the fastest way...it's been a while, and not sure if in v2005 there are any new tools to do so. The easiest and fastest way to download the content inside a VSS database on ...Show All
SQL Server sum report item
Is there anyway to sum a value that resides in a textbox ie; =Sum(ReportItems!MyTextBox.value) I am happy that you found a way. I was gonna suggest that you add a calculated field to your dataset and that you sum with this new field for all of your groupings. ...Show All
.NET Development DataSet.AcceptChanges
If i have a dataset binded to a datagird and i make some changes on those columns on that datagrid and when i click a buttons my dataset calles its AcceptChanges method will that update those changes in my dataset so that when i open my form again those changes are still there within that column of the row that i changed in my datagrid Thank you for you timely reply. I'm just trying to add data to a table I created with the Database Designer in Visual C# studio. I created a table named DataTable1 within the database dbTutorial. I created a DataSet and a BindingSource using the visual components, and then wrote this code to add an entry: dbTutorialDataSet1.DataTable1.AddDataTable1Row( "first" , &q ...Show All
Windows Forms Dataset & DataGrid???
I have a dataset that holds some data, and when i show it in the data grid i would like it to be editable, and changed in my dataset, can anyone send me a link or shed some light on how i should get this done do not use acceptchanges() otherwise when you update, it will not update the changes to the database since the rows modified in the dataset have been marked to "not needed to be updated" Remember, you need to rebind the datagridview after you have done an update() - do you see the updates commited in SQL Server database/table To be safe for now, I would suggest you comment out the SqlCommandBuilder and just do an Update() directly after making sure that your SqlDataAdapter has the SqlCommand in its constructor as ...Show All
Windows Forms Problem with dataset Designer
I am using a strongly typed dataset with .NET 2.0, my problem is that customized queries in tableadapters are not reachable, and do not appear in the dataset.designer.vb the following error appears: "Cannot find custom tool 'MSDataSetGenerator' on this system." I hope that you have a solution for this ...Show All
Visual C# Accessing a public item through an interface
Hi, Hopefully somone can point me in the right direction on this.. I have an application that has to be able to handle multiple file types, so im using an interface to access the created object. So i have class1 and class2 and they both implement my interface, at loadtime the app creates one of these objects depending on the format. Everything about this works fine, but each of these classes have an array of public items and my question is: Is it possible to access these public items through the interface eg: myObject.items[4] In case its not clear what im trying to do i made a sample app with the exact same structure: http://www.turnipfan.com/sample_code.rar Thanks for any help, -Dave ...Show All
Visual Basic deployment of vb.net windows application problem
hi all how life is going in these days I using vb.net and access i use the com component in my project of vb (like msflexgrid,mshflexgrid) i deploy project windows application using setup wizard what i am required in user machine 1)framework 2)internet exploer 6.0 for com what is required please help when i load it on user machine then they shows jit compilers error thanks in advance hi sir Jit Debugging failed with the following error :0x800405a6 Please check the documentation topic 'JUST-IN-TIME Debugging error ' for more information i read it form msdn in which show no user log on but in user machine i log on.i tick in deploy source code also i installed all .net vs 2003 then i show ...Show All
Visual Studio Interactive Mode pages
I have the interactive page size set to 8.5 X 11, just like the actual page size. Shouldn't the page #s match in this case Or at least be reasonably close It seems like the interactive mode doesn't stop for the page when it should. Do you use any kind of conditional visibility expressions on the table, table groups, or table details In that case, page breaks are ignored in interactive formats. -- Robert ...Show All
Internet Explorer Development .Net Framework 3.0 and IE7
I've downloaded and installed the darn .net framework 3.0. Its quite cool but i've experiencing the IE7 context menu problem. After installing the netfx 3.0 my browser doesnt open the context menu when I right click on any web pages. Dont tell me that the sites might be resticted to show the context menus, I ve tried on my own web site. Even Microsoft sites and so on. Is there anyone experienced the same problem thank you! ...Show All
Visual Studio New Report Viewer Redistributable package with SP1?
When Visual Studio SP1 is released can I assume there will me a new msi package for distributing the control Any time frame on this Thanks How about a method to install the new report viewer dll's onto a team build server Before we used the redistributable, but as of right now, we're stuck with a broken build because our build server doesnt have the updated reportviewer dll's, which is obviously a very serious problem. Also, this issue needs to be listed on the KB article that goes along with the service pack. If i had know it was going to break our build system, i never would have updated. ...Show All
