|
Have you tried an update query?
UPDATE tbl SET tbl.Col = "\\"
WHERE tbl.Col Like "%.%";
DEBUGGING : Removing the needles from the haystack.
-- modified at 4:57 Friday 21st October, 2005
|
|
|
|
|
Hi sfdougl ! thanks for responding.
Would, what you suggested work on a DataTable in memory? or how would you do that to a DataTable in memory I guess is my question. I do not want to modify the source (sql) table and be able to update this list and spit it out into an excel file or text file. I also need to display this table in a datagrid to determine extra processing.
Here is my goal..
1. Read sql table..
2. Example row (always a string) "one.two.three"
3. Pull this data from a sql table and store into a DataTable and display in a DataGrid.
4. Output row "one\two\three" by replacing '.' with '\'
5. Also, if need be modify it to "one.two.three.four" - has to be determined at runtime.
6. Output this to a text file. I cannot modify the source.
|
|
|
|
|
What database technology are you using?
Which technology are you using to access the database?
I know ADO (pre .NET). I might have an option for you but without knowing what you’re using kind of hard to know the answer.
It should be possible to pull the data you seek from the db save it to XML and then modify that to suit the users needs (without looping).
Or you could always create a temp table to modify and drop the table after the data has been modified.
(sorry its taken so long to get back to you, I dont use the computer on the weekends )
DEBUGGING : Removing the needles from the haystack.
-- modified at 4:15 Monday 24th October, 2005
|
|
|
|
|
I am using a SQL server backend, and connecting using the SQLClient dataadapter in .NET (Visual Studio .NET 2003). I don't mind creating a temp table to modify, but again I'm unsure of how to bulk modify an entire table without looping. In fact even now I am only using a temp table which i populate using my select query.
I did consider XML, but didn't get the chance to play with it as yet.
thanks again for responding !
|
|
|
|
|
See my other post about using the Replace command as part of the SQL query. That should do the trick.
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
blackhole077 wrote: 1. Read sql table..
2. Example row (always a string) "one.two.three"
3. Pull this data from a sql table and store into a DataTable and display in a DataGrid.
4. Output row "one\two\three" by replacing '.' with '\'
Simple solution, should work for most RDBMS engines (cant believe I forgot about this one).
If you don’t mind transforming the data when pulling it out of the db use the ‘Replace’ TSQL command. This will not change the underlining data, only its presentation.
SELECT Replace([txt],".","/") AS epr
FROM tbl;
You indicated the display will be determined at runtime. So just do a simple switch or if to determine which way to pull the data. Hows that sound?
Transact-SQL Reference Replace[^]
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
Sorry, it took so long to reply. I will try this out! I also found out that there was more manipulation required with the string than I had anticipated and I'm going in another direction, probably with arraylists or arrays. Thanks for your help! I really appreciate it!
|
|
|
|
|
No problem, always glad to try and help...
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
I have an application with a strongly typed Dataset which I populate and then transform the rows in the DataTable into objects used in my application. The application then updates the objects and I call code to update the appropriate DataRows before submitting the updates to the table.
I originally wrote the method to update the DataRow to update each column in the row using the value in the object passed in. This however causes the RowState of the DataRow to change from Unchanged to Modified even if the value has not changed. Therefore I have logic to check the values in the DataRow with the value in the object and only update if there is a change, this logic incorporates checking for null values also.
Is there any method of getting the DataRow to do this automatically?
|
|
|
|
|
Hi every body,
I have two questions which I failed to know their answers:
1- What is the best to make an ADO.NET connection with a DB (in a form in VB.NET) with one table in or with many tables but have a relationship between them through SQL?Why?
2- What is the best technique used in Vb.net to make a form has a connected DB. Is it by writing the code by ourselves Or, by using the available ADO.NET data providers(OLEDB) in the Toolbox in VB.NET?Why?
With Thanks.
-- modified at 8:57 Thursday 20th October, 2005
|
|
|
|
|
Deema Jack wrote: 1- What is the best to make an ADO.NET connection with a DB (in a form in VB.NET) with one table in or with many tables but have a relationship between them through SQL?Why?
There are many different ways. All have their pros and cons depending on the situation and what you want to use it for. What do you want to do?
Deema Jack wrote: 2- What is the best technique used in Vb.net to make a form has a connected DB. Is it by writing the code by ourselves Or, by using the available ADO.NET data providers(OLEDB) in the Toolbox in VB.NET?Why?
The best "technique" is to use some sort of data abstraction model. Create a class (or set of classes) whose responsibility is to access the database and let your form get on with the job of dealing with the user interface. Let everything do its thing well, rather than create some sort of monster that cannot do anything well.
If you think this answer is not very good it is because I am attempting to provoke you into starting a discussion where you tell us more about what you are doing and then perhaps we can guide you towards the right way to do it.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
I think I may be missing something simple as I can't find a similiar problem on the internet, so any help would be greatly appreciated. I am trying to access an SQL Server database through sharepoint via a web part. However I have sql client permission errors.
An Error has occurred: Request for the permission of type System.Data.SqlClient.SqlClientPermission, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
I have tried many different connection strings and authentication modes but always have the same error.
The connection string currently is:"Data Source=lons3003;Initial Catalog=FF;Integrated Security=SSPI;"
Thanks in advance
|
|
|
|
|
Integrated Security? This means you have to give the web service thread the proper rights to access the SQL server. I usually go with a SQL username/password scheme instead of giving IUSR_* anonomous accounts any real domain rights.
|
|
|
|
|
Thank you for responding but I still have the same problem using username and password.
server = Server;database=db;uid=sa;persist security info = true;
any other suggestions?
|
|
|
|
|
Your Connection string should look something like this:
"Server=Aron1; Database=pubs; User ID=bob; Password=asdasd; Trusted_Connection=False"
I hope you are not using 'sa' (with or without a password).
I would create a specfic user on the SQL server with the exact rights necessary to accomplish your goals. It doesn't make sense to expose your system to the Internet like that.
You will find a whole set of connection string patterns on: www.connectionstrings.com [^]
|
|
|
|
|
Cheers. But I get the same problem using the username and password string.
|
|
|
|
|
Is your web server out of your domain/firewall zone? Maybe you don't have access to talk on the port (default 1433). Try and open the port from a using telnet from a command prompt on the web server (XXX is the IP number of the SQL Server):
telnet XXX.XXX.XXX.XXX 1433
If you go to a blank screen then you are connected (you will have to [X] out of the app at that point). Otherwise a connect error will be displayed.
|
|
|
|
|
Cheers but the two are connected and can talk to one another.
|
|
|
|
|
i need help look i disigned a aplication in csharp and i use crystal report
but when i instal the aplicacion run correct when i print some thins they sendme this error
ee the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
CrystalDecisions.CrystalReports.Engine.InternalException: Cannot find KeycodeV2.dll, or invalid keycode.
at .K(String
, EngineExceptionErrorID )
at .G(String , Int32 )
at CrystalDecisions.CrystalReports.Engine.ReportDocument.@()
at CrystalDecisions.CrystalReports.Engine.ReportDocument.InternalInit()
at CrystalDecisions.CrystalReports.Engine.ReportDocument..ctor()
at CrystalDecisions.CrystalReports.Engine.ReportClass..ctor()
at Elias.porfavor..ctor() in C:\Documents and Settings\lobo\Mis documentos\Visual Studio Projects\Elias\porfavor.cs:line 21
at Elias.Form9.button2_Click(Object sender, EventArgs e) in c:\documents and settings\lobo\mis documentos\visual studio projects\elias\form9.cs:line 255
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
|
|
|
|
|
I've also been facing this problem , but i found the
solution which worked for me . I donn't whether it's a perfect solution or not someone may present a better to
you. But for now you can try it .
Just uninstall dotNet Framework from the PC on which you are deploying/testing you application , Restart the PC
then again install dotNet framewok perhaps from other source , Your Pervious may not work as i think some of the libraries are missing .
Best of luck
|
|
|
|
|
I use the following code to move to the next record. I need to get the key field data of that record. Can someone please help, I have been reading and searching but I cannot find anything. I do not know how to use the DataRowView code, I think it gets me to the current row. But how do I get the data in a field?
this.BindingContext[dsAnimal1, "animal-info"].Position += 1;
DataRowView rv = (DataRowView)this.BindingContext[dsAnimal1, "animal-info"].Current;
DataRow r = rv.Row;
|
|
|
|
|
I am writing an application where I am using strongly typed DataSets to define the DataTables and relations used in various parts of the application. I have code that takes these DataSets and converts the rows in the DataTables to objects which I then use in my application. The reason for using strongly typed DataSets is so if I change the database schema I only need to validate the DataSets to identify any mismatches at compilation time.
I obviously need to fill the DataSets which is currently done by creating SqlAdapters which call stored procedures to populate the DataTables within the DataSet. This means I have to keep the stored procedures in sync with the DataSets when the schema is changed. I am trying to minimise any potential bugs and so I am looking at ways to ensure the database schema, DataSets and stored procedures are kept in sync.
My current method is to use my own validation tool which performs tests on the DataSets to ensure the stored procedures correctly fill the DataSets.
Given the information contained within the DataSet I was thinking that it should be possible to "auto-generate" the SQL from the DataTables and DataRelations definitions. For a simple situation like Customers and Orders this is not difficult but I was wondering if there are any libraries or tools out there which generate SQL code from a DataSet definition given the complexity that may be involved with many tables and their relationships.
|
|
|
|
|
|
which is the easiest and most efficient means to debug stored procedures?
pls help
|
|
|
|
|
If you are talking about MS SQL Server:
Open SQL Query Analyzer, right click on your stored procedure, click on Debug. It will prompt you to input values for for the parameters, then you click Execute. It will let you single step through the stored proc, and has a window for current variable values.
If debugging is not enabled for your instance of SQL Server, you may have to install the option from cd. Also, it needs the SQL Server Agent service to be running.
To debug triggers, just write a stored proc which will cause a trigger to execute, then you can step into the trigger when debugging the stored proc.
|
|
|
|