5,346 Posted Topics
Re: > I would like to know if trhere is a way to limit the results and then retrieving more after the user has scrolled down more. If you've Ms-Sql server database then you may fetch limited rows from the table. SELECT * FROM ( SELECT *, ROW_NUMBER() OVER (ORDER BY … | |
Re: You should have to use System.Text.StringBuilder. StringBuilder sb=new StringBuilder(); while ((line = sr.ReadLine()) != null) { sb.Append(line); } | |
Re: Beacuse you've posted the cut & paste code so it is better for you to read this MSDN blog post - [Creating a Home Page View Using Razor Syntax](http://msdn.microsoft.com/en-us/vs2010trainingcourse_aspnetmvc3razor_topic2.aspx) | |
Re: Always use the [JSTL](http://stackoverflow.com/q/3177733/142822) <c:forEach var="count" begin="0" end="5"> <div id="div_${count}"> </div> </c:forEach> | |
Re: Always use the parameters. cmd=new SqlCommand() cmd.CommandText = " INSERT INTO tblVehicle (VehicleNo,vehicleModel,vehiclePlat,[Type of License],TotalOfDriver) VALUES (@VehicleNo,@vehicleModel,@vehiclePlat,@TypeofLicense,@TotalOfDriver)" cmd.Connection=con cmd.Parameters.Add("@VehicleNo",SqlDbType.VarChar,20).Value=TxtNo.Text cmd.Parameters.Add("@vehicleModel",SqlDbType.VarChar,20).Value=TxtModel.Text cmd.Parameters.Add("@vehiclePlat",SqlDbType.VarChar,20).Value=TxtPlat.Text cmd.Parameters.Add("@TypeofLicense",SqlDbType.VarChar,20).Value=CmbLicense.Text cmd.Parameters.Add("@TotalOfDriver",SqlDbType.VarChar,20).Value=CmbDriver.Text con.Open() cmd.ExecuteNonQuery() con.Close() | |
Re: Use bb code tags. [noparse] [CODE=C#] ... ... [/CODE] [/noparse] Look at bin folder's database1.mdf. ![]() | |
Re: Welcome iajm, I'm glad you found it useful. Have you noticed that the current thread is two years old? Please do not resurrect old/solved threads. If you want to ask question, start your own thread. Read before posting- [url]http://www.daniweb.com/forums/thread78223.html[/url] | |
Re: >using c# and clicking a calander which will go to a booking form from each day Handle the event of calendar and use page redirection method (Redirect or Transfer). >how to add database to this? Learn and use ADO.NET. | |
Re: You need to retrieve the path of image from the database and assign or bind it to ImageUrl property of Image control. | |
Re: Have a look at official microsoft site - http://www.asp.net/ | |
Re: Please read the MSDN documentation about [Caching.](http://msdn.microsoft.com/en-us/library/xsbfdd8c(v=vs.100).aspx) | |
Re: Method [CODe=Java] Runtime.getRuntime().exec() [/CODE] requires an external command. CLS is internal dos command. To run internal command using exec() we have to use CMD (external) command. Try it at command prompt. [CODE] >cmd /? -- help >cmd /c cls [/CODE] [CODe=Java] // Will create a new process Process ps=Runtime.getRuntime().exec (new … | |
Re: Welcome sgavriel. We appreciate your help. Have you ever noticed that the current thread is three years old? Please do not resurrect old threads. Take a look at forum[URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]rules[/URL]. Thread Closed. | |
Re: Fetch the DateTime column value from the database, Cast it to DateTime type and assign this value to the DateTimePicker1.Value property. Something like this: IF reader.Read() Then DateTimePicker1.Value=reader.GetDateTime(0) End IF | |
Re: Try the [Directory.Delete(string path. bool recursive) ](http://msdn.microsoft.com/en-us/library/fxeahc5f.aspx)method. | |
Re: You can't save the reference of Page (Read the MSDN about asp.net page life cycle). You need to use Session/Cookie/ViewState (State Management) to persist the data. | |
Re: Wrap the page_load event code in `IsPostBack` block Protected Sub Page_Load(sender As Object, e As System.EventArgs) IF Not IsPostBack Then Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c: .... End IF End Sub | |
Re: Use DateTime.AddMonths, AddDays methods. Dim dt = #12/20/2010# dt = dt.AddMonths(1) dt = dt.AddDays(-(dt.Day - 1)) | |
Re: What will happen when a user type following in the TextBox: `hello' or '1'='1` One must have to avoid the [SQL Injection](http://en.wikipedia.org/wiki/SQL_injection) by creating stored procedure or parameterized query. string cnstr=ConfigurationManager.ConnectionStrings["RegConnectionString"] .ConnectionString; bool found=false; using(SqlConnection con = new SqlConnection(cnstr)) { string cmdStr = "Select username from Reg where Username = … | |
Re: You need to set [B]path[/B] not a [B]classpath[/B] for javac (compiler) and java (launcher). [code] PATH=......;c:\Program Files\Java\Jdk1.7\Bin [/code] | |
Re: Fill() method create an instance of DataTable and DataTable instance hold references of rows (fetched result). [code] int a=0; if(myDataSet.Tables[0].Rows.Count!=0) { a= (int) myDataSet.Tables[0].Rows[0][0]; //1st row and 1st column } [/code] | |
Re: Enabled the ListView1.ShowItemToolTips = True. [CODE=VB.NET] ListView1.View = View.LargeIcon ListView1.ShowItemToolTips = True For lcount As Integer = 1 To 3 ListView1.Items.Add(lcount.ToString, lcount - 1).ToolTipText = "Item" & lcount Next [/CODE] | |
Re: Firstly, you have to create the array and after that instantiate the LinkedList elements. Dim myarray(3) As LinkedList(Of String) For i As Integer = 0 To myarray.GetUpperBound(0) myarray(i) = New LinkedList(Of String) Next | |
Re: The web-browser cannot execute the ASP.NET control markup & server side scripting code. ASP.NET is the web-technology to generate the dynamic content of HTML/CSS/JavaScript and it requires web-server along with application server to execute server side script (Code of VB.NET or C#). | |
Re: You have to typecast it explicitly, checked { usTest = (UInt16)(Convert.ToUInt16(sTest) + usOne); usTest = (UInt16)(Convert.ToUInt16(sTest) + 1); usTest = (UInt16)(Convert.ToUInt16(sTest) + Convert.ToUInt16(1)); } | |
Re: You need to create the image handler. Have a look at Image [handler tutorial](http://www.codeproject.com/Articles/34084/Generic-Image-Handler-Using-IHttpHandler). | |
Re: Have a look at FAQ - [How to avoid Java Code in JSP-Files?](http://stackoverflow.com/questions/3177733/how-to-avoid-java-code-in-jsp-files) | |
Re: Iterate the `GridView.Rows` collection, extract value from the specific cell using `Cells` collections, and convert/parse the extracted value to decimal/integer. | |
Re: You have to use FileUpload.PostedFile properties. int fileLen = FileUpload1.PostedFile.ContentLength; string contentType=FileUpload1.PostedFile.ContentType; ... if(fileLen>=1 && fileLen<=1024*1024) { // } if(contentType=="image/jpeg") { //code } | |
Re: Of course Yes! The [Model-View-Controller](http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) is the design-pattern. | |
Re: You have to parse the 'string' data to the appropriate simple type before the calculation. for instance, double no1=double.Parse(textboxnumber1.Text); double no2=double.Parse(Label1.Text); You may also use XXXXX.TryParse method. e.g double no1; double.TryParse(textboxnumber1.Text,out no1); | |
Re: You need to add the `Image` control into GridView's `TemplateField` or just use `ImageField`. | |
Re: You may store the diff of two datetime object values using `TimeSpan` structure. `Timespan diff=end-start;` | |
Re: Use MM instead of mm (minutes) `DateTime.Parse(PlanAdmit).ToString("YYYY-MM-dd")` | |
Re: What about `rid(5`) at line #14? I think it should be `reader(5`). PS: Never use hard-coded SQL strings. Use parameters. Dim Sql = "SELECT * FROM Account where Username=@Username" Dim UserName As String = String.Empty Using con As New OleDbConnection("your_conn_str") Using Command As New OleDbCommand(Sql, con) Command.Parameters.Add("@Username", OleDbType.VarChar, 40).Value = … | |
Re: Never use hard-coded sql strings. Always use Parameters. cmd.CommandText = "select * from exam where category=@category"; cmd.Parameters.AddWithValue("@category",Request.QueryString["cat"]); | |
Re: You have to use `GDI API` to draw the text. Learn/use the classes from `System.Drawing` namespace. private void Form1_Load(object sender, EventArgs e) { this.Paint += (sa, ea) => { ea.Graphics.DrawString("Bold Text", new Font("Arial", 10f, FontStyle.Bold), Brushes.Black, new PointF(5, 5)); }; } | |
Re: Please check the column/cell value. I think the 2nd cell has non-numeric. If the ID is at 1st cell then try, `Id = Convert.ToInt32(row.Cells[0].Text);` or change index of Cells to 1 if ID is at second cell and so on | |
Re: You need to save the connection strings under `<connectionString/>` section and read it using `System.Configuration.ConfigurationManager.ConnectionString["CnStr_Name"].ConnectionString`. <connectionStrings> <add name="CnStr" connectionString="............" providerName="System.Data.SqlClient"/> </connectionStrings> | |
Re: [b]>how to pass more values (to be shown one under another) in just one parameter.[/b] [code] cryRep.SetParameterValue("@data", new int[]{10,20,30,40}); [/code] | |
Re: Because VB.NET version 2005 and later version uses "Default Form Instance". ([URL="http://stackoverflow.com/questions/4698538/there-is-a-default-instance-of-form-in-vb-net-but-not-in-c-why"]here[/URL] is good discussion) It means the name of Form (or you can say class name) represents an instance (object reference) and of course the form inside you are working is also an instance of same form. In short … | |
| |
Re: >I have to creat a dynamic table through asp.net in database. That is bad design. You should try to consider the alternative of this design. | |
Re: Use GetBoolean() method of DataReader. [code] ... var1=daraRead.GetBoolean(1) ... [/code] | |
Re: Take a look at code snippet, [code] Dim dt As New Data.DataTable dt.Columns.Add("Name") dt.Columns.Add("Status") dt.Rows.Add("A", "Paid") dt.Rows.Add("B", "Unpaid") DataGridView1.AutoGenerateColumns = False DataGridView1.DataSource = dt Dim Name As New DataGridViewTextBoxColumn Name.DataPropertyName = "Name" Dim Status As New DataGridViewComboBoxColumn Status.DataPropertyName = "Status" Status.Items.Add("Paid") Status.Items.Add("Unpaid") DataGridView1.Columns.Add(Name) DataGridView1.Columns.Add(Status) [/code] | |
Re: Welcome sphe_g. I appreciate your eagerness to learn Database programming. I suggest you to buy a [URL="http://www.amazon.com/dp/073562206X/?tag=stackoverfl08-20"]good[/URL] book and also visit MSDN online [URL="http://msdn.microsoft.com/en-us/data/aa937722.aspx"]pages[/URL]. | |
Re: DateTime formats: 1. [url]http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.aspx[/url] 2. [url]http://authors.aspalliance.com/aspxtreme/sys/demos/datetimeformats.aspx[/url] | |
Re: The ASP.NET can remove data from the cache when: 1. Memory on server is low 2. Cache is expired etc. You must have to use [I][URL="http://msdn.microsoft.com/en-us/library/aa478965.aspx"]Cache Early; Cache Often[/URL][/I] technique to avoid such problems. [CODE]if(Cache["key"]==null){ //create cache entry Cache["key"]=value; } ....[/CODE] | |
Re: You should have to create public properties in User control. For instance, [CODE]public String Name { get{ return txtName.Text;} set { txtName=value;} } [/CODE] | |
Re: You need to extends the Button class. [CODE]public class NewButton : Button { public int X {get;set;} public int Y {get;set;} }[/CODE] |
The End.