你得利用ADONET的数据库连接类和函数。你可以把你的存储过程放到数据库管理器的查询分析器中执行一次,这样以后你就可以直接使用这个存储过程了,而不要另外编译了。如下:
string constring = “你的数据库连接字符串”;
SqlConnection mycon = new SqlConnection(constring);
SqlCommand mycomd = myconCreateCommand();
myconOpen();
mycomdCommandText = "execute pd_name @userName,@userPass ";
SqlDataReader myread = mycomdExecuteReader();
int PosOfjava = myreadGetOrdinal("java");
while (myreadRead())
{
ConsoleWriteLine("cno=" + myread[PosOfjava]);
ConsoleWriteLine();
}
在C#中如果只用指针的话,需要用到unsafe关键字
[DllImport(XXXdll)]
unsafe private extern static int 函数名();
unsafe private void 函数名()
{
int nP = 函数名();
int n = nP;
nP++;
}
函数名是你DLL中的函数名
通过指针运算符,访问每一个元素,前提是你得知道数组里有多少个元素
去阿帕奇下载apacheorg/poi
项目的源码:
import orgapachepoissusermodelRow
import orgapachepoixssfusermodelXSSFCell
import orgapachepoixssfusermodelXSSFRow
import orgapachepoixssfusermodelXSSFSheet
import orgapachepoixssfusermodelXSSFWorkbook
/
Created by WangQing on 15/11/20
/
class TestGroovy {
void updateResourceDate(){
def filePath = "/assets/peoplexlsx"
File file = new File(filePath)
FileInputStream is = new FileInputStream(file);
XSSFWorkbook workbook = new XSSFWorkbook(is);
workbooksetMissingCellPolicy(RowCREATE_NULL_AS_BLANK);
//循环sheet
(0<workbooksheetIterator()collect {return it}@size)each {s->
XSSFSheet sheet = workbookgetSheetAt(s);
int rows = sheetphysicalNumberOfRows;
//忽略第一行,标题行
(1<rows)each{r->
XSSFRow row = sheetgetRow(r);
def cells = rowphysicalNumberOfCells;
(0<cells)each{c->
XSSFCell cell = rowgetCell(c);
def name = "";
switch (c) {
case 0:
name = "A:"
break;
case 1:
name = "B:"
break
case 2:
name = "C:"
break
case 3:
name = "D:"
break
}
print name + " "+cell+ ", ";
}
println "";
}
}
}
static main(args) {
TestGroovy a = new TestGroovy();
aupdateResourceDate();
}
}
以上就是关于在C#中如何获取一个函数的返回值全部的内容,包括:在C#中如何获取一个函数的返回值、springMVC拦截器中如何获得被拦截方法的返回值、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)