VS 2003/2005, when you edit a procdure, "save" means create/alter SQL Server 2005 Management Studio, if you want to create a procedure, writing code first then run and create the proc
zhengdong jin
Posts
-
sql server 2005 -
ctrl+c and ctrl+v not working in TextBoxyou don't need to write any code for this ctrl-c ctrl-x and ctrl-v...
-
creating insert statement using arrayspublic string[] GenInsertCmd(DataTable table) { string inscmd = "insert into " + table.TableName.Trim().ToLower() + " ("; foreach(DataColumn col in table.Columns) { inscmd += col.ColumnName + ","; } inscmd = inscmd.Substring(0,inscmd.Length - 1) + ") values ("; string[] sqlcmd = new string[table.Rows.Count]; int i = 0; foreach(DataRow row in table.Rows) { sqlcmd[i] = ""; foreach(DataColumn col in table.Columns) { switch (col.DataType.Name.Trim().ToLower()) { case "string": try { sqlcmd[i] += "'" + ((string)row[col]).Trim().Replace("'","\"") + "',"; } catch { sqlcmd[i] += "null,"; } break; case "datetime": try { sqlcmd[i] += "'" + ((DateTime)row[col]).ToString("yyyy-MM-dd hh:mm:ss.sss") + "',"; } catch { sqlcmd[i] += "null,"; } break; case "boolean": try { sqlcmd[i] += ((bool)row[col] == true ? "1," : "0,"); } catch { sqlcmd[i] += "null,"; } break; case "byte[]": sqlcmd[i] += "null" + ","; break; default: if (row[col].ToString().Trim() == "") sqlcmd[i] += "null,"; else sqlcmd[i] += row[col].ToString().Trim() + ","; break; } } sqlcmd[i] = inscmd + sqlcmd[i].Substring(0,sqlcmd[i].Length - 1) + ")"; i += 1; } return sqlcmd; }
-
returning arrays from functionpublic string[] getname() { DataSet ds = yourquery string[] abc = new string[ds.Tables[0].Rows.Count]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { abc[i] = ds.Tables[0].Rows[i]["name"].ToString(); } return abc; }
-
Generating SQL Table and Insert statementsSET IDENTITY_INSERT table on insert select SET IDENTITY_INSERT table off
-
T-SQL Syntax -
How to count users loged in the terminal server ? [modified]what server is it just windows or iis
-
Live videoif you are using ASP.NET with C# protected override void CreateChildControls() { base.CreateChildControls(); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("")); this.Controls.Add(new LiteralControl("
-
Live video<OBJECT id="MediaPlay1_WMP" style="WIDTH: 100%; HEIGHT: 100%" classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" VIEWASTEXT> <PARAM NAME="URL" VALUE="mms://200.20.30.19/broadcast"> <PARAM NAME="rate" VALUE="1"> <PARAM NAME="balance" VALUE="0"> <PARAM NAME="currentPosition" VALUE="0"> <PARAM NAME="defaultFrame" VALUE=""> <PARAM NAME="playCount" VALUE="1"> <PARAM NAME="autoStart" VALUE="-1"> <PARAM NAME="currentMarker" VALUE="0"> <PARAM NAME="invokeURLs" VALUE="-1"> <PARAM NAME="baseURL" VALUE=""> <PARAM NAME="volume" VALUE="50"> <PARAM NAME="mute" VALUE="0"> <PARAM NAME="uiMode" VALUE="full"> <PARAM NAME="stretchToFit" VALUE="0"> <PARAM NAME="windowlessVideo" VALUE="0"> <PARAM NAME="enabled" VALUE="-1"> <PARAM NAME="enableContextMenu" VALUE="-1"> <PARAM NAME="fullScreen" VALUE="0"> <PARAM NAME="SAMIStyle" VALUE=""> <PARAM NAME="SAMILang" VALUE=""> <PARAM NAME="SAMIFilename" VALUE=""> <PARAM NAME="captioningID" VALUE=""> <PARAM NAME="enableErrorDialogs" VALUE="0"> </OBJECT>
-
Installing .CAB file in PDA using Visual studio.net 2003copy the .cab file to you ppc and install it
-
Finding the installed CAB file in Pocket PC.\program files\your_prg
-
Concatenate several records into oneuse function create function abc(@TicketId char(x)) returns char(xxx) as begin declare @ret char(xxxx) declare @tmp table ( .... ) insert into @tmp (...) select .... while ... begin ... set @ret = @ret + Narrative end return @ret end select TicketId,dbo.abc(ticketid) 'Narrative' from yourtable
-
how to count the characters in one variable?C#youstring.Trim().Length();
Today is Windows Mobile
-
Date is changing from a one day.:) select getutcdate() select getdate()
-
Image in SQL Server 2000asp.net, try { SqlDataReader reader = this.oCon.GetReader( @"select filesize,contenttype,filedata from file_personal (index=pk_file_personal nolock) where fileid = " + e.Item.Cells[5].Text); this.Page.Response.ContentType = (string)reader["contenttype"]; this.Page.Response.AppendHeader("Content-Disposition:", "attachment; filename=" + HttpUtility.UrlEncode(e.Item.Cells[7].Text)); this.Page.Response.OutputStream.Write((byte[])reader["filedata"], 0, (int)reader["filesize"]); this.Page.Response.End(); } catch { this.Page.RegisterStartupScript("", "alert('error!');"); return; } ASP.NET Windows APP Mobile App http://www.eReach.cn
-
Image in SQL Server 2000:) 1 you can create a proc first like: create proc p_pic_i @filename nvarchar(100), @filesize int, @jpgdate image as insert into pic ( filename, filesize, filedata) values ( @filename, @filesize, @filedata) if @@rowcount = 1 and @@error = 0 return @@identity else return -1 go 2 then write a function to call this proc, sorry this is c# not vb.net public int csf_p_News_ext_i( string filename, int filesize, byte[] filedata, SqlConnection conn) { SqlCommand cmd = new SqlCommand("p_News_ext_i",conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@RETURN_VALUE",SqlDbType.Int,4); cmd.Parameters["@RETURN_VALUE"].Direction = ParameterDirection.ReturnValue; cmd.Parameters.Add("@filename",SqlDbType.NVarChar,200); cmd.Parameters["@filename"].Value = filename; cmd.Parameters.Add("@filesize",SqlDbType.Int,4); cmd.Parameters["@filesize"].Value = filesize; cmd.Parameters.Add("@filedata",SqlDbType.Image); cmd.Parameters["@filedata"].Value = filedata; int retvar = -1; try { conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); retvar = (int)cmd.Parameters["@RETURN_VALUE"].Value; } catch { retvar = -1; } return retvar; } 3 read stream(asp.net) Byte[] FileByteArray = new Byte[filelength]; Stream StreamObject = UpFile.InputStream; StreamObject.Read(FileByteArray,0,filelength);
-
pass dataset to new databasejust use t-sql select * into [your new table] from [source data table] or insert into [dest data table] ... select ... from [your source table] even you can write a c# function also use the same ASP.NET C# VB VC & SQL Windows APP ...
-
Paging for DataGridHere is an article about pager control, may be you can ... http://www.codeproject.com/useritems/DataGrid_Pager.asp[^] ASP.NET C# VB VC & SQL Windows APP ...
-
Bubble Event Implementation in UserControlI had submited an article about a datagrid pager control in the source code you can find some useful hints. http://www.codeproject.com/useritems/DataGrid_Pager.asp[^] good luck ASP.NET C# VB VC & SQL Windows APP ...
-
Pocket PC Emulator HelpYou need to deploy your app to a Emulator you selected ASP.NET C# VB VC & SQL Windows APP ...