I think most developers have enjoyed the distinct separation of programmable data objects and the OO code. Correct me if I am wrong, but I am pretty sure that there are important differences between, for example, an Oracle DB and SQL Server. I know @@Identity does not exist in Oracle.
Private_Void
Posts
-
No more stored procedures -
Dataset/DataTable with DataGrid (local database only!)The data in file C:\DataSource.txt from code Looks exactly like below.... Magenta,1/2/03,XDSDF Blue,1/2/05,None //I know this is kind of messy but i just slapped it together. let me know if you have any questions. StreamReader s; string[] columns = {"Color_Used","Install_Date","Error_Code"}; DataSet ds = new DataSet(); grvMain.DataSource = ds; ds.Tables.Add("tblMain"); for (int i = 0; i < columns.Length; i++) { ds.Tables["tblMain"].Columns.Add(columns[i]); } string sFieldDelimiter = ","; string sRowDelimiter = "\r\n"; s = new StreamReader(@"C:\DataSource.txt"); string sAllData = s.ReadToEnd(); string[] sRowsColSplit = sAllData.Split(sRowDelimiter.ToCharArray()); foreach (string row in sRowsColSplit) { if (row != "") { string[] rows = row.Split(sFieldDelimiter.ToCharArray()); ds.Tables["tblMain"].Rows.Add(rows); } } grvMain.DataBind();
-
Dataset/DataTable with DataGrid (local database only!)I am beginning to understand what your datasource is / looks like. Could you please send me an example of a row of data or two rows of data and I am sure I can assist you.
-
Dataset/DataTable with DataGrid (local database only!)What type of database is your local database?
-
Use stored procedure to check if database existThis will return all of the tables from the db the query is running under... select * from sysobjects where xtype = 'u'
-
Please Help me :(Columns with constraints or keys can not have null values. You will need to either eliminate the constraint on the AssignedTo column or will have to provide the same value from the insert in both places. In the db if you run sp_help [TableName] you will see the constraints for both of your tables and I am fairly sure that you will see a constraint on the AssignedTo Column.
-
Please Help me :(It looks like you are inserting a value into tblUser, but the Column inUserID needs to have the same value as what is going into tblUser.
-
Use stored procedure to check if database existIf you are using SQL Server 2005 you can write a proc to use select * from sys.databases.
-
hihi
-
Stored ProcedureThe code looks good to me. You dont need to specify a length for sqldatatype int, but I don't know if this causes a problem in the proc. The only other thing i could think of is where you are looking for results in the db is not where the connection string is pointed to. Other than that I don't see anything wrong with it.
-
C# Array ProblemI would do something like this. public bool isMatch() { bool Matches = false; string[] asCompare = new string[4]; asCompare.SetValue("First0", 0); asCompare.SetValue("Second1", 1); asCompare.SetValue("Third2", 2); asCompare.SetValue("Fourth3", 3); Random ran = new Random(); int iVal = ran.Next(asCompare.Length - 1); string sValue = asCompare[iVal]; char[] chars = sValue.ToCharArray(); string sCharTracker = ""; for (int i = 0; i < chars.Length; i++) { sCharTracker = chars[i].ToString(); //Matches = //you would probably do your compare with a method call here// } return Matches;//This will be if it matches or not// }
-
How old did you start programming?I started programming at 6 on a commadore 64. I was so young I think it was BASIC , but the syntax (barely can remember) was something like, FOR I=1 TO 5 PRINT I NEXT -> 1 2 3 4 5.
-
Select Distinct QuestionAssuming "Oldest" means been in the DB the Longest. And I understood what you are trying to do this should be pretty close. I did this without a SQL Server so forgive if a little off. SELECT T1.SenderID, T2.MIN([TimeStamp]), T2.MIN(Body) AS Body FROM Messages T1 INNER JOIN ( SELECT MIN[TimeStamp] AS MINTimeStamp ,Body FROM Messages GROUP BY Body )T2 ON T1.Body = T2.Body AND T1.[TimeStamp] = T2.[TimeStamp] WHERE RecipeintID = 1 GROUP BY T1.SenderID
-
Select Distinct QuestionAssuming "Oldest" means been in the DB the Longest. And I understood what you are trying to do this should be pretty close. I did this without a SQL Server so forgive if a little off. This is more complex than first meets the eye due to the fact that you need to tie in the Oldest TimeStamp with its cooresponding Body field. SELECT T1.SenderID, T2.MIN([TimeStamp]), T2.MIN(Body) AS Body FROM Messages T1 INNER JOIN ( SELECT MIN[TimeStamp] AS MINTimeStamp ,Body FROM Messages GROUP BY Body )T2 ON T1.Body = T2.Body AND T1.[TimeStamp] = T2.[TimeStamp] WHERE RecipeintID = 1 GROUP BY T1.SenderID
-
Select Distinct QuestionAssuming "Oldest" means been in the DB the Longest. This is more complex than first meets the eye due to the fact that you need to tie in the Oldest TimeStamp with its cooresponding Body field. SELECT T1.SenderID, T2.MIN([TimeStamp]), T2.MIN(Body) AS Body FROM Messages T1 INNER JOIN ( SELECT MIN[TimeStamp] AS MINTimeStamp ,Body FROM Messages GROUP BY Body )T2 ON T1.Body = T2.Body AND T1.[TimeStamp] = T2.[TimeStamp] WHERE RecipeintID = 1 GROUP BY T1.SenderID I did this blind, without sql around, so forgive me if it is a little off. It should be pretty close to what you are looking for if I understood what you were trying to do. SELECT T1.SenderID, MIN(TimeStamp) AS MINStamp, Body AS Body FROM @Messages T1 INNER JOIN ( SELECT GROUP BY SenderID
-
Drag and drop the contents of a particular column in a table.Someone may be able to provide assistance if you give some context in which you are speaking. For example drag "alphabet" from last row and drop it in any of the first 2 rows. Where are these rows and from where are you dragging and dropping?
-
Getting row number in RDLC reportThe systax is =RowNumber(Scope as String); Scope as String is the "name of a dataset, grouping, or data region that contains the report items to which to apply the aggregate". per msdn2 So if you have a table in your report named table2 the sytax would be... =RowNumber("table2") Hope this helps let me know if you need anything else.
-
iterating arraylistsTry this. using System; using System.Collections.Generic; using System.Text; using System.Collections; namespace Assistant { class Program { static void Main(string[] args) { ArrayList al = new ArrayList(4); al.Add("Val1"); al.Add("Val2"); al.Add("Val3"); al.Add("Val4"); int iListLen = al.Count; for (int i = 0; iListLen > i; i++) { if (al[i].ToString() == "Val3") { al.RemoveAt(i); break; } } } } }
-
Combining Columns In A ResultSetYou are close make your query look like this; SELECT TeamA FROM Under11s. UNION ALL SELECT TeamB FROM Under11s This should work.
-
Looping through a datagridAre you looking for something like this... grvMain.Rows[0].Cells[1].Text; I hope this helps. I have worked quited a bit with gridviews so let me know if I misunderstood your question. If you have controls you are attempting to check in the cells it should look more like this... ((TextBox)GridView1.Rows[1].FindControl("txtProviderID")).Text. Regards